javascript - Slide Effects for Tabs Part 2 -


ok original question got answered , slide effect happens when click in anywhere in div region..here code:

$(document).ready(function(){ $('#tabs').tabs();  $("#tabs").click(function() {      $(this).effect( "slide", "medium" );  }); }); 

now i'm wondering if wants copy text 1 of tab regions? every single time try highlight, tab slide away. how make tab region slides when actualy tab ul clicked?

use combination of mousedown , mouseup:

demo fiddle

var down=0; $(document).ready(function(){     $("#tabs").mousedown(function(event){         down=event.clientx+"||"+event.clienty;     });     $("#tabs").mouseup(function(event){         var up=event.clientx+"||"+event.clienty;         if(up==down)         $(this).slideup("medium" );     }); }); 

updated code prevent slidedown on right-click copy text:

demo fiddle 2

var down="||"; $(document).ready(function(){     $("#tabs").mousedown(function(event){         switch(event.which){         case 1:/*left mouse button pressed*/             down=event.clientx+"||"+event.clienty;             break;         default:/*middle or right mouse button pressed*/             down="||";         }     });     $("#tabs").mouseup(function(event){         var up=event.clientx+"||"+event.clienty;         if(up==down)         $(this).slideup("medium" );     }); }); 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -