jQuery show/hide rendering duplicate content

I'm pretty new to jquery so bear with me. I'm doing a simple show/hide on multiple div's. Basically you hover over an image with a class and are shown the content from a div with the corresponding class. The thing I'm running into is if you hover over an image and then hover over another image there are instances when I'm seeing content from the previous hover and the current one essentially duplicating content. This is really only when your hovering fast over images but annoying none the less. Any ideas why this would be happening? jQuery('document').ready(function(){ jQuery('.company').not(':first').hide(); jQuery('#company_container img').on('hover', function(){ var contenttoShow = jQuery(this).attr('data-title'); contenttoShow2 = jQuery(contenttoShow); jQuery('.company').hide(); contenttoShow2.fadeIn(500); }); });

some content goes here

some content goes here

some content goes here

以上就是jQuery show/hide rendering duplicate content的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » jQuery 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准