您的位置:首页 > Web前端 > CSS

和css有关的方法有这些:

2016-06-13 10:16 666 查看
1、增 $(this).addClass("class1")   删  .removeClass("class2")

2、$(this).attr("className","class1") //attr两个功能之一 赋值     如下实例:

 $(cs).attr("classqweasd", "xuanzhong BorderTrb  hand ");这里的classqweasd
是所选元素的一个属性 可以是类名

      2 取值

3、$(this).toggleClass("class1")如果原来没有class1就添加class1,如果原来有class1就移除class1

4、 $("#change_me").css("color":"yellow")

 $("#change_me").css(

{"color":"yellow","left":"0"})

 $("#change_me").toggle( 2000);//如果被选元素可见,则隐藏这些元素,如果被选元素隐藏,则显示这些元素。

 $("#change_me").animate({ "top": "400", "font": "50px arial", "color": "red" }, 2000, "linear");// top400指距离上边距的位置
color不起作用  2000是过渡时长2秒

补充: this.style.cssText = "background-color:green;color:yellow;font-size:19px;

$("li").find("ul").css('background-color','blue');
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: