欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

drupal quicktabs mouseover instead of click quicktabs 鼠标放上去事件代替鼠标点击发生的事件

shiping1 的头像

Has anyone gotten the Quicktabs module to work on mouseover/hover instead of click?
There was a patch for version 6.x-2 that does not work with the current version.

shareimprove this question
 add comment

I ended up making a couple of edits to quicktabs.js. At its most basic, in line 24 I changed 'click' to 'mouseenter' and changed the name of the quicktabsClick() function to quicktabsHover().

When the user clicked the link in the tab, though, the page refreshed; I added the following at line 25 (below the new call to quicktabsHover):

$(this).unbind('click').bind('click', quicktabsClick);

I also added a new function:

var quicktabsClick = function() {
    return false;
}
shareimprove this answer
 
   
You are not making changes to the modules JS files are you? –  saadlulu Oct 31 '12 at 7:36
   
I did, yes. And I'm making sure not to update. –  jay-ess Oct 31 '12 at 21:12
   
@jay-ess Make a patch and submit to Drupal.org –  Nikhil M Dec 6 '12 at 6:48 
   
@Nikhil - This really needs to be something that is configurable, which I did not do and is out of my league. I believe there has been some talk about making it so, but I have not revisited.–  jay-ess Dec 6 '12 at 16:15


来自 http://drupal.stackexchange.com/questions/18984/mouseover-instead-of-click
 



<script>
jQuery(document).ready(function () {
  if (jQuery( '#quicktab_block_name').length > 0) {
    jQuery('#quicktab_block_name .quicktabs-tabs li').each(function() {
      jQuery('a', this).bind({
        mouseenter: function(){
          jQuery(this).click();
        }
      });
    });
  }
});
</script>


来自 https://drupal.org/node/1376018
普通分类: