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
Post a Comment