首页 > Web开发 > 详细

jquery css()

时间:2018-07-04 12:29:05      阅读:137      评论:0      收藏:0      [点我收藏+]

 css()   jquery  改变dom属性方法, ()内放{}对象

如下代码:

<div id="text"></div>

   <p>点击按钮换背景</p>
   <button class="btn">换换换 </button>

  样式()

#text{
			width: 50rem;height: 20rem; background: url(‘images/b3.jpg‘) no-repeat;
		}

  js

$(document).ready(function(){
			$(".btn").click(function(){
				$("#text").css({"background":"url(‘images/3.jpeg‘) repeat"})
				$("#text").css({"width":"40rem","height":"40rem"})
			})
		})

  总结: css( )设置style里面的属性值     

                (ps :  attr()获得或者设置元素的某个属性值   设置属性值时 属性值可以使函数值 

              obj.attr("title",function(){ return this.alt}); 
              alert($("ul li:eq(1)").attr("title")); )

 

jquery css()

原文:https://www.cnblogs.com/1403723150cxf/p/9262459.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!