开发者

Simulating :active with jQuery

开发者 https://www.devze.com 2023-01-04 08:22 出处:网络
For hover, I do this: $(\'.btn\').hover(function (event) { $(this).toggleClass(\'hover\'); }); Is there any similar w开发者_StackOverflow社区orkaround for :active? Need it for the damned IE6.You ca

For hover, I do this:

$('.btn').hover(function (event) {
   $(this).toggleClass('hover');
});

Is there any similar w开发者_StackOverflow社区orkaround for :active? Need it for the damned IE6.


You can use jQuery mousedown() to simulate this.

Look at the example here:

http://api.jquery.com/mousedown/#example-0

$('.btn').mousedown(function(){
    $(this).addClass('active');
}).mouseup(function(){
    $(this).removeClass('active');
});


Theres some info on here:

http://csscreator.com/node/31976

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号