zoukankan      html  css  js  c++  java
  • html 事件干扰

    <style>
    .div-content {
    overflow: hidden;
    }

    .div-title {
    height: 20px;
    160px;
    border: 1px solid #eee;
    }

    .div-content-ul {
    165px;
    position: absolute;
    left: 0;
    display: none;
    }

    .div-content-ul ul {
    margin: 0;
    padding: 0;
    list-style: none;
    }

    .div-content-ul ul li {
    padding: 0 5px;
    line-height: 24px;
    border-bottom: 1px dotted #ccc;
    }
    </style>
    <div class="div-content">
    <div class="div-title"></div>
    <div class="div-content-ul">
    <ul>
    <li><a href="javascript:;" title="快捷搜索" urlparam="">全部数据1</a></li>
    <li><a href="javascript:;" title="快捷搜索" urlparam="">全部数据2</a></li>
    <li><a href="javascript:;" title="快捷搜索" urlparam="">全部数据3</a></li>
    <li class="curr"><a href="javascript:;" title="快捷搜索" urlparam="">全部数据4</a></li>
    <li><a href="javascript:;" title="快捷搜索" urlparam="">全部数据5</a></li>
    <li><a href="javascript:;" title="快捷搜索" urlparam="">全部数据6</a></li>
    </ul>
    </div>
    </div>

      

    $(document).ready(function () {
    $('.div-content-ul ul li').click(function () {
    $('.div-title').html($(this).text());
    $('.div-content-ul').hide();
    });
    $('.div-content-ul li').each(function () {
    if ($(this).hasClass('curr')) {
    $(this).trigger('click');
    }
    });
    var t;
    $('.div-title').mousemove(function (e) {
    clearTimeout(t);
    $(this).next('.div-content-ul').slideDown(100);
    e.stopPropagation();
    }).mouseleave(function (e) {
    var f;
    $(this).next('.div-content-ul').mousemove(function () {
    clearTimeout(f);
    }).mouseleave(function () {
    clearTimeout(t);
    t = setTimeout(function () {
    $('.div-content-ul').hide();
    }, 100);
    });
    f = setTimeout(function () {
    $('.div-content-ul').hide();
    }, 100);
    });
    });

  • 相关阅读:
    Detect loop in a singly linked list
    Partition an array around an interger
    Binary search for the first element greater than target
    Searching in a rotated and sorted array
    where, group by, having
    [scalability] Find all documents that contain a list of words
    [DP] 堆盒子问题
    cocos2dx 内存管理的理解
    cocos2dx 2.x版本:简化提炼tolua++绑定自定义类到lua中使用
    OpenGl从零开始之坐标变换(下)
  • 原文地址:https://www.cnblogs.com/lccnblog/p/3608085.html
Copyright © 2011-2022 走看看