zoukankan      html  css  js  c++  java
  • 解决click与hover(mouseover)的冲突问题

    主要应用到一个知识点:$(selector).data('name','value');

    <!DOCTYPE HTML>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>无标题文档</title>
    <style type="text/css">
          .content{
              100px;
              height:100px;
              border:2px solid #999;
              border-radius:10px;
           }
           .active{
            background:red;
           }
           .onbackground{
            background:green;
           }
    </style>
    
    
    <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
    </head>
    <body >
    <div class="content">
         <button class="seemore">查看</button>
      </div>
        <script>
           
          $('.content').mouseover(function(){
               
               var a = $(".content").data("flag");
                 console.log(a);
                 if(a==1){
                  
                 }else{
                   $(this).addClass("onbackground");
                 }
               
            });
    
    
            $(".content").mouseout(function(){
    
    
                  $(this).removeClass("onbackground");
              })
            
            $(".seemore").click(function(){
               $(this).parent().addClass("active");
               $(".content").data("flag","1");
            })
    
    
            
              
            
        </script>
        
    
    
    </body>
    </html>
  • 相关阅读:
    python第一课
    go反射----4构建
    go反射----3方法
    go反射----2值
    go生成xml
    go互斥锁Mutex
    go中的读写锁RWMutex
    go语言调用cmd
    go语言发送邮件
    go语言文件操作
  • 原文地址:https://www.cnblogs.com/smedas/p/12614263.html
Copyright © 2011-2022 走看看