首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >为什么悬停和点击并不总是有效的?

为什么悬停和点击并不总是有效的?
EN

Stack Overflow用户
提问于 2014-10-15 13:53:50
回答 2查看 133关注 0票数 1

这是我的小提琴

除了鼠标、鼠标保存、点击功能(.item)之外,几乎完全正常工作--并且需要点击鼠标才能重新开始工作?为什么-这是我的密码-

代码语言:javascript
运行
复制
       $(document).ready(function () {
     $('.timelineTile').click(function (evt) {
      evt.stopPropagation();
    $('.timelineTile').not(this).removeClass('clicked').find('.pull_down_content').height(0);
      $(this).toggleClass('clicked');

    if(!$('.timelineTile').hasClass("clicked")){
     $(this).children('.pull_down_content').height(0);

       }   


        }); });

     $(document).click(function () {
   $('.timelineTile').removeClass('clicked');
   $('.pull_down_content').height(0);
     $('.inner').stop().css({'display': 'none'}, 300); 
    });


       $(document).ready(function () {
     $('.timelineTile').children('.item').on('mouseenter mouseleave click', function(e) {      e.stopPropagation();
     if ($(this).parent('.timelineTile').hasClass("clicked")) {
    if (!$(this).data('clicked')) {
        var Height = e.type==='mouseenter' ? '90px' : e.type==='click' ? '250px' : '0px';
        $(this).siblings('.pull_down_content').stop().animate({'height': Height}, 300); 

         $(this).siblings('.pull_down_content').children('.inner').css({'display': 'block'},  300); 

        if (e.type==='click') $(this).data('clicked', true);
    }else{
        if (e.type==='click') {
            $(this).data('clicked', false);
            $(this).siblings('.pull_down_content').stop().animate({'height': '0px'}, 300);
   $(this).siblings('.pull_down_content').children('.inner').css({'display': 'none'}, 300);          

        }
    }  

     } 
                 });


     });

我不确定这和这有什么关系吗?

代码语言:javascript
运行
复制
    if(!$('.timelineTile').hasClass("clicked")){
     $(this).children('.pull_down_content').height(0);

      }  
EN

Stack Overflow用户

回答已采纳

发布于 2014-10-15 16:17:53

试着替换

代码语言:javascript
运行
复制
$('.timelineTile').not(this).removeClass('clicked').find('.pull_down_content').‌​height(0); 

有了这个

代码语言:javascript
运行
复制
$('.timelineTile').not(this).removeClass('clicked').find('.pull_down_content').‌​height(0).end().find('.item').data('clicked',false); 
票数 1
EN
查看全部 2 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26384341

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档