Blogger Information
Blog 34
fans 2
comment 2
visits 22659
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
css方法-20180406 15:25
AsNwds_MIS王的博客
Original
506 people have browsed it

实例

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>css方法</title>
	<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
	<script type="text/javascript">
		$(function(){
			$('.one').click(function(){
				$('img').addClass('change')
			})
			})
		$(function(){
			$('.two').click(function(){
				$('h2').css('color','red')
			})
			})
		$(function(){
			$('.three').click(function(){
				$('img').removeClass('change')
			})
			})	
		$(function(){
			$('.four').click(function(){
				$('img').css('width','+=50')
			})
			})	
		$(function(){
			$('.five').click(function(){
				alert($('img').offset().left)
			})
			})
		$(function(){
			$('.six').click(function(){
				$('div').toggleClass('blue')
			})
			})
		$(function(){
			$('.seven').click(function(){
				alert($('div').position().top)
			})
			})			
	</script>


	<style type="text/css">
		.change{
			border-radius: 50%;
			box-shadow: 2px 2px 2px #888;
		}
		.blue{
			color: blue;
		}
	</style>
</head>
<body>
	<h2>学习css()方法完整用法</h2>
	<img src="timg.jpg" alt="" width="100px" height="100px">
	<p>css()是用来操纵元素style{}的</p>
	<p>使用函数来设置 CSS 属性</p>
	<div>设置多个 CSS 属性值</div>
	<button class="one">增加图的类</button>
	<button class="two">设置h2的属性</button>
	<button class="three">移除类</button>
	<button class="four">增加图片的宽</button>
	<button class="five">返回图片位置</button>
	<button class="six">样式自动切换</button>
	<button class="seven">position()获取位置</button>
	
</body>

</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例

微信图片_20180406152346.jpg微信图片_20180406152353.jpg无标题.png

Correction status:Uncorrected

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post