开发者

jQuery function ignore class

开发者 https://www.devze.com 2023-02-04 06:17 出处:网络
I\'ve got an interesting situation. I\'m building a music page using an open source flash music player that degrades to html for mobile users. I\'ve got everything working great except for on开发者_St

I've got an interesting situation. I'm building a music page using an open source flash music player that degrades to html for mobile users. I've got everything working great except for on开发者_StackOverflow中文版e issue.. and that is that one of my Javascript functions is interfering, specifically an anchor color fade.

There are many hidden buttons involved in the player, but the play/pause button has a translucent anchor underneath it and code is forcing this to be shown when the buttons are hovered over.

I can't seem to get the syntax correct using the not function.. But I'll settle for anything that works!

Thank you!

HTML

<div class="sc-player">

Javascript

jQuery(function ($) {
     $('a').not('div.sc-player').each(function () {
         var $el = $(this),
             orig = $el.css('color');
         $el.hover(function () {
             $el.stop().animate({ color: '#00B0D9' }, 400);
         },function () {
             $el.stop().animate({ color: orig }, 400);
         });
     });
 });


In jQuery (make sure you've got the color animation plugin from jQ UI: http://jqueryui.com/demos/animate/):

jQuery(function ($) {
    $('a.a').each(function () {
        var $el = $(this),
            orig = $el.css('color');
        if ($el.parents('.sc-player').length!=0) return;
        $el.hover(function () {
            $el.stop().animate({ color: '#00B0D9' }, 400);
        },function () {
            $el.stop().animate({ color: orig }, 400);
        });
    });
});
0

精彩评论

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

关注公众号