【问题标题】:jquery hover state after opacity不透明度后的jquery悬停状态
【发布时间】:2012-11-05 05:31:35
【问题描述】:

单击按钮后,图像不透明度会发生变化,但重新按钮仍会出现在悬停时 一旦图像的不透明度发生变化,是否可以完全移除红色按钮...

http://jsfiddle.net/mwPeb/11/

在下面提供我的 js 代码

  $(document).ready(function(){
                  $(".specialHoverOne").hover(function(){
    //  alert("i am here");
                    $(".ctaSpecialOne").css("visibility","visible");


                    },
                    function(){
                        $(".ctaSpecialOne").css("visibility","hidden");
                  }
                  );

     $(".ctaSpecialOne").click(function(e){
                        e.preventDefault();

                        $(this).parent().prev().prev().css({'opacity':.5});    

                 }); 


                });

【问题讨论】:

    标签: jquery-ui jquery jquery-plugins jquery-selectors


    【解决方案1】:

    是的...假设 .ctaSpecialOne 是红色按钮的类...

    $(".ctaSpecialOne").on('click', function(){
        $(this).remove();
    });
    

    集成到您的代码中

     $(".ctaSpecialOne").click(function(e){
          e.preventDefault();
         $(this).parent().prev().prev().css({'opacity':.5});
         $(this).remove();   
     }); 
    

    【讨论】:

    • 他要求在不透明度改变之后,那只会让它变得很简单......所以不透明度不会有任何影响,而且是多余的......
    • 不透明度影响杂志元素...当点击按钮时,它会改变杂志的不透明度并移除按钮。很简单。
    • 哈哈,谢谢...我真的希望不要在早上的第一件事就进入“评论”战x)
    • @VIDesignz:感谢您的回复是否有可能获得这种不透明度docs.google.com/file/d/0B3IBJKENGE7RS1lwZzhYbTNRbkk/edit?pli=1jsfiddle.net/mwPeb/18您的代码有效
    • @user1828505 你的意思是Logo在中间?
    【解决方案2】:
    $(this).parent().prev().prev().css({'opacity':.5}).stop(true,true).delay(1).queue(function (){
        ... your code here ...
        $(this).dequeue();
    });  
    

    这就是我通常的处理方式......

    我还建议将.css 更改为.animate 然后您可以执行以下操作...

    $(this).parent().prev().prev().stop(true,true).animate({'opacity':.5}).delay(1).queue(function (){
        ... your code here ...
        $(this).dequeue();
    });  
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-07-27
    • 1970-01-01
    • 2013-04-15
    • 2011-01-08
    • 2018-01-23
    • 1970-01-01
    • 2011-06-08
    • 2017-06-10
    相关资源
    最近更新 更多