in Education by
I'm wondering how to stop an animation made with jQuery timers. I think I have tried everything, I would really like your help. <!DOCTYPE html> HeartMath - Danmark jQuery.fn.log = function (msg) { console.log("%s: %o", msg, this); return this; }; var fixgeometry = function() { /* Some orientation changes leave the scroll position at something * that isn't 0,0. This is annoying for user experience. */ scroll(0, 0); /* Calculate the geometry that our content area should take */ var header = $(".header:visible"); var footer = $(".footer:visible"); var content = $(".content:visible"); var viewport_height = $(window).height(); var content_height = viewport_height - header.outerHeight() - footer.outerHeight();; /* Trim margin/border/padding height */ content_height -= (content.outerHeight() - content.height()); content.height(content_height); }; /* fixgeometry */ $(document).ready(function() { $(window).bind("orientationchange resize pageshow", fixgeometry); var animationSpeed = 3500; var animationHeight = $(window).height() * 0.70; $("input[type='radio']").bind( "change", function(event, ui) { if($(this).val() == "true") { startAnimation(animationSpeed); $(this).log("animationen burde starte"); } else { stopAnimation(); $(this).log("animationen burde stopppe"); } }).log("der blev trykket"); function startAnimation(animationDuration) { $(".breather").everyTime(10, function(){ $(".breather").animate({top:animationHeight}, animationDuration).animate({top:"0"}, animationDuration); }).log("startAnimation"); }; function stopAnimation() { $(".breather").stopTime().stop().log("stopAnimation"); }; }); html, body { width: 100%; } div.breather { display: block; position:relative; } }
landscape!
What happens now is that when i press stop.. the animation just reverses and loops again JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
When you call .stop() to stop the jQuery animation, change it to .stop(true) to clear the animation queue (docs here). I'm not sure why there is a queue, but it looks like it has something to do with the timers plugin that you are using. Use queue().length to see how many animations are left in the queue.

Related questions

0 votes
    I have created a partial view, the element in the partial view looks like this (Razor Code): @Html ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 16, 2022 in Education by JackTerrance
0 votes
    I have created a partial view, the element in the partial view looks like this (Razor Code): @Html ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 16, 2022 in Education by JackTerrance
0 votes
    I want to get this format : 2019-03-24 15:05:20 Here is what I have tried: var today = ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 14, 2022 in Education by JackTerrance
0 votes
    I want to get this format : 2019-03-24 15:05:20 Here is what I have tried: var today = ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 14, 2022 in Education by JackTerrance
0 votes
    I want to get this format : 2019-03-24 15:05:20 Here is what I have tried: var today = ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 14, 2022 in Education by JackTerrance
0 votes
    I found found several question's answers similar to this, I tried some of them, but no luck. May ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    I found found several question's answers similar to this, I tried some of them, but no luck. May ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 8, 2022 in Education by JackTerrance
0 votes
    How can I get the td values with jquery? The while loops will generate a few with the same class ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 26, 2022 in Education by JackTerrance
0 votes
    I am trying to convert string into integer using jquery but it throwing NumberFormatException. How to fix it ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    I want to make a new span class called "button". When the "button" is clicked, it should run ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 4, 2022 in Education by JackTerrance
0 votes
    Have jquery dialog as closeOnescape as false. want to trigger an event based on esc key press how do ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    I am trying to add controls to a simple jquery carousel however I am not sure of how to do that. ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 26, 2022 in Education by JackTerrance
0 votes
    I am trying to add controls to a simple jquery carousel however I am not sure of how to do that. ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 18, 2022 in Education by JackTerrance
0 votes
    Course Results (${courseResponseList.getCourses().size()}) Want to show above div. jquery script. jQuery. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 6, 2022 in Education by JackTerrance
0 votes
    Course Results (${courseResponseList.getCourses().size()}) Want to show above div. jquery script. jQuery. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 20, 2022 in Education by JackTerrance
...