Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery event doubling when button is clicked
    primarykey
    data
    text
    <p>I have been struggling with this problem all day.</p> <p>I have a jQuery button that when clicked fadesIn a field. The field is a scrollable table that scrolls three times to the left and three times to the right.</p> <p>The scroll length is related to its container size (overflow:hidden) however the problem I am having is that everything works fine unless I click onj the original button again. Each time this button is clicked it doubles the value of the scroll distance each direction. It is almost as if the button is doubling the event.</p> <p>$(document).ready(function(){</p> <pre><code>$('.pcode_btn').click(function(event){ var pcode=$('.pcode').val(); var pcode=$('.pcode2').val(); if(pcode==""){ //nothing entered alert("Please enter your clients postcode"); return; } //show calender $('.calender_holder').fadeIn(500); $('.instr').text("Select a suitable time when your client is available for one of our agents to visit by selecting an available time-slot below."); //slide calender $('.next').click(function(event){ if($('.date_holder').css('left') != '-1743px') { $(this).prop('disabled', true) $('.date_holder').animate({left:'-=581px'}, 500, function() { $('.next').prop('disabled', false) }); } return false; }); $('.prev').click(function(event){ if($('.date_holder').css('left') != '0px') { $(this).prop('disabled', true) $('.date_holder').animate({left:'+=581px'}, 500, function() { $('.prev').prop('disabled', false) }); } return false; }); }); </code></pre> <p>});</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload