Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You are binding your click event handler on every <code>orientationchange</code> so they get queued. Try to put your events in a namespace and unbind all events in this namespace on <code>orientationchange</code> before rebinding them. Her a simple example:</p> <pre><code>// assume these are the events bound to different some buttons $('#foo').on('click.myNS', ...); $('#bar').on('keyup.myNS', ...); $('#baz').on('dblclick.myNS', ...); // magic occurs here... $('#foo, #bar, #baz').off('.myNS'); // ...and afterwards, the three binds from above are gone </code></pre> <p>So in your case it would be:</p> <pre><code>jQuery(window).bind('orientationchange', function (e) { // First of all, we need to unbind previous events $("a.more-button, #next-page, #prev-page, .menu-link").off(".MyClickEvents"); if (Math.abs(window.orientation) == 0) { $('#slider').animate({ height: '375px' }); $('#top').animate({ height: '445px' }); $('#strap').animate({ top: '445px' }, false); $("a.more-button").on("click.MyClickEvents", function () { $('#slider').css({ 'height': '375px' }); $('#top').css({ 'height': '445px' }); $('#strap').css({ 'top': '445px' }); console.log('it fired 0'); }); return false; } if (Math.abs(window.orientation) == 90) { $("a.more-button").on("click.MyClickEvents", function () { $('#slider').animate({ height: '0px' }); $('#top').animate({ height: '130px' }); $('#strap').animate({ top: '130px' }, false); console.log('it fired 90'); }); $("#next-page").on("click.MyClickEvents", function () { $('#slider').animate({ height: '375px' }); $('#top').animate({ height: '445px' }); $('#strap').animate({ top: '445px' }, false); }); $("#prev-page").on("click.MyClickEvents", function () { $('#slider').animate({ height: '375px' }); $('#top').animate({ height: '445px' }); $('#strap').animate({ top: '445px' }, false); }); $(".menu-link").on("click.MyClickEvents", function () { $('#slider').animate({ height: '375px' }); $('#top').animate({ height: '445px' }); $('#strap').animate({ top: '445px' }, false); }); return false; } if (Math.abs(window.orientation) == -90) { $("a.more-button").on("click.MyClickEvents", function () { $('#slider').animate({ height: '0px' }); $('#top').animate({ height: '130px' }); $('#strap').animate({ top: '130px' }, false); console.log('it fired -90'); }); $("#next-page").on("click.MyClickEvents", function () { $('#slider').animate({ height: '375px' }); $('#top').animate({ height: '445px' }); $('#strap').animate({ top: '445px' }, false); }); $("#prev-page").on("click.MyClickEvents", function () { $('#slider').animate({ height: '375px' }); $('#top').animate({ height: '445px' }); $('#strap').animate({ top: '445px' }, false); }); $(".menu-link").on("click.MyClickEvents", function () { $('#slider').animate({ height: '375px' }); $('#top').animate({ height: '445px' }); $('#strap').animate({ top: '445px' }, false); }); return false; } if (Math.abs(window.orientation) == 180) { $('#slider').animate({ height: '375px' }); $('#top').animate({ height: '445px' }); $('#strap').animate({ top: '445px' }, false); $("a.more-button").on("click.MyClickEvents", function () { $('#slider').css({ 'height': '375px' }); $('#top').css({ 'height': '445px' }); $('#strap').css({ 'top': '445px' }); console.log('it fired 180'); }); return false; } }, false); </code></pre>
 

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