Note that there are some explanatory texts on larger screens.

plurals
  1. POJQuery to recreate Apple 2011 product browser - error after repeated use
    primarykey
    data
    text
    <p>I have been working on recreating apple.com 2011 product browser with JQuery and CSS. Mission accomplished but as the user continues to use the menu system it starts to become erratic with the wrong items coming in in the wrong order.</p> <p>I believe the problem lies in the delayed execution of certain functions and I am not sure weather this is limited to certain browsers or not. The problem exists on the third click on mobile safari, many clicks later on safari and chrome and has not yet been encountered on an old version of firefox.</p> <p>The system also uses the enhanced animate plugin for JQuery that uses CSS3 where possible.</p> <p>Sample: <a href="http://jsfiddle.net/Y5anX/5/" rel="nofollow">http://jsfiddle.net/Y5anX/5/</a></p> <pre><code>$(document).ready(function(){ var bounceholder = 0; var delayact = 0; $('.bouncetabs a').click(function(){ $('.bouncetabs a').removeClass('active'); $(this).addClass('active'); if($(this).index('.bouncetabs a') &lt; bounceholder) { var backwards = 1 } else { var backwards = 0 } bounceholder = $(this).index('.bouncetabs a'); var bounceoffset = 0; if($('.bounceholder ul:eq(' + bounceholder + ') li').length == 6){ var bounceoffset = 0;} else if($('.bounceholder ul:eq(' + bounceholder + ') li').length == 5){ var bounceoffset = 72;} else if($('.bounceholder ul:eq(' + bounceholder + ') li').length == 4){ var bounceoffset = 144;} else if($('.bounceholder ul:eq(' + bounceholder + ') li').length == 3){ var bounceoffset = 216;} else if($('.bounceholder ul:eq(' + bounceholder + ') li').length == 2){ var bounceoffset = 288;} $('.bounceholder ul:eq(' + bounceholder + ')').prevAll().each(function(p) { $('li', this).delay(150).animate({left: -200, top:0, opacity:0, leaveTransforms:true}, 600); }); $('.bounceholder ul:eq(' + bounceholder + ')').nextAll().each(function(f){ $('li', this).delay(150).animate({left: +1000, top:0, opacity:0, leaveTransforms:true}, 600); }); if(backwards == 1) { bounceoffset = 800 - bounceoffset; $($('.bounceholder ul:eq(' + bounceholder + ') li').get().reverse()).each(function(i){ delay = (i + 1) * 250; $(this).delay(delay).animate({left: bounceoffset, top:0, opacity:0.6, leaveTransforms:true}, {duration:400, queue:true}); bounceoffset -= 160; }); } else { $('.bounceholder ul:eq(' + bounceholder + ') li').each(function(i){ delay = (i + 1) * (250 * delayact); $(this).delay(delay).animate({left: bounceoffset, top:0, opacity:0.6, leaveTransforms:true}, {duration:400, queue:true}); bounceoffset += 160; }); } delayact = 1; return false }); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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