hasClass用法

hasClass:检查当前元素是否含有某个特定的类,如果有,就返回true。

下载本地,做外部链接:

HTML结构:

 <div class="protected">div><div class="er">div>

CSS代码:

 //这里注意div容器要设置绝对定位!
.protected
{ width:100px; height:100px; background:#ff0; position:absolute; z-index:50; }
.er { width:100px; height:100px; background:#f00; position:absolute; z-index:50; top:200px; }

jQuery代码:

 

 

 

 

转载于:https://www.cnblogs.com/pqw1991/archive/2012/08/30/2663400.html

你可能感兴趣的:(java,python,javascript)