disable .click function on an anchor in jquery

Posted by user554014 on Stack Overflow See other posts from Stack Overflow or by user554014
Published on 2010-12-25T22:24:02Z Indexed on 2010/12/25 22:54 UTC
Read the original article Hit count: 142

Filed under:
|
|
|
|

This is written in an external .js with jquery...

I have two windows that slide in and out of view like:

$(document).ready(function() {
  // hides gallery1 as soon as the DOM is ready  
  $('#gallery1').hide();  
  // shows the menu on click   
  $('#showgal1').click(function() {  
    $('#gallery1').delay(490).show('slide', {direction:'left'});
    $('#gallery2').hide('slide', {direction:'right'});
    //need code to disable showgal1 and enable showgal2
  });
  $('#showgal2').click(function() {  
    $('#gallery2').delay(490).show('slide', {direction:'right'});
    $('#gallery1').hide('slide', {direction:'left'});
    //need code to disable showgal2 and enable showgal1
  });
});

'gallery1' and 'gallery2' are DIV's with flash image galleries and 'showgal1' and 'showgal2' are id's of anchors...

looks like

<a href="#" id="showgal1">gallery 1</a>

I cannot find a way to disable the .click function when one is clicked and re-enable the other...

i want to disable 'showgal1' by default and when 'showgal2' event takes place it removes the attribute and makes 'showgal2' disabled until 'showgal1' is clicked...

the .attr('disabled','disabled') hasn't worked yet...

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about onclick