javascript - jQuery click runs one time -


i working on jquery gallery thumbnails , have 2 arrows "scroll" through these thumbnails. first tried click event animation runs 1 time then.

i have searched internet , found .on( 'click' ) event. tried no result. using .off( 'click' ) remove event after.

can me this?

$("#top_slide_button").on( 'click', function () {     $("#slide_frame").animate( { marginbottom: -50 }, 200);     $("#top_slide_button").off( 'click' ); });  $("#bottom_slide_button").on( 'click', function () {     $("#slide_frame").animate( { margintop: -50 }, 200);     $("#bottom_slide_button").off( 'click' ); }); 

you can try this:

$("#top_slide_button").off( 'click' ).on( 'click', function () {     $("#slide_frame").animate( { marginbottom: -50 }, 200); });  $("#bottom_slide_button").off( 'click' ).on( 'click', function () {     $("#slide_frame").animate( { margintop: -50 }, 200); }); 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -