停止slideToggle div在悬停时展开向下滚动浏览器

时间:2017-12-03 03:56:35

标签: javascript jquery css

我有一个div文本显示和隐藏使用SlideToggle悬停。问题是当div靠近浏览器顶部并将鼠标悬停在它上面以展开它时,div会向下滚动浏览器而不是从视图端口扩展。

以下是example的链接。它的四列图像在"我们已经得到了你的回报"部分。最后3列正常工作,只有第一列表现如前所述。

$(' .expandColumn').mouseenter(function() {    
     if ($(window).width() > 768) {        
      $(this).children('.copyWrapper').children('.showWrapper').stop().slideToggle();     
        $(this).children('.copyWrapper').children('.roundButton').children('.bg').addClass('bgOver');
        $(this).children('.copyWrapper').children('.roundButton').children('.cross').children('.a').addClass('blackBG');
        $(this).children('.copyWrapper').children('.roundButton').children('.cross').children('.b').addClass('blackBG');
       $(this).children('.copyWrapper').children('.roundButton').children('.readmore').stop().fadeIn();                       
     }        

});

 $(' .expandColumn').mouseleave(function() {         
      if ($(window).width() > 768) {        
         $(this).children('.copyWrapper').children('.showWrapper').stop().slideToggle();
         $(this).children('.copyWrapper').children('.roundButton').children('.bg').removeClass('bgOver');
         $(this).children('.copyWrapper').children('.roundButton').children('.cross').children('.a').removeClass('blackBG');
         $(this).children('.copyWrapper').children('.roundButton').children('.cross').children('.b').removeClass('blackBG');
         $(this).children('.copyWrapper').children('.roundButton').children('.readmore').stop().fadeOut();              
      }
});

enter image description here

enter image description here

0 个答案:

没有答案
相关问题