javascript - Either toggling or remove class A and add class B on click with a delay -
i have jquery mobile page has jquery chat feature. type chat , few seconds later bot responds.
behind chat feature , filling whole page class has background image, , wish have when type text field , hit send background image class toggles class has different background image. wish have 2-3 second delay.
i have tried
$(function () { $("#chatsend").click(function () { $(this).parent(".tastetherainbow").toggleclass("ornot"); }); });
here jsfiddle...the background image not show there. https://jsfiddle.net/mattmega4/d9yodhtm/
one solution this:
$(this).closest(".tastetherainbow").fadeto('fast', 0, function () { $(this).toggleclass("ornot").fadeto('fast', 1); });
see demo: https://jsfiddle.net/d9yodhtm/3/
Comments
Post a Comment