开发者

Simulating :active with jQuery

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜