When examining the Apple slider, there are several interesting elements at play.
The utilization of JavaScript to capture the click event triggers a change in attribute within the <ul>
element, subsequently altering the CSS and initiating an animation through CSS3 transitions.
Upon inspecting the code:
A portion of the HTML code reveals the presence of the exited
and entered
attributes, which are modified by JavaScript when a new section needs to be displayed (via onclick).
<ul class="ul-slider" page="1" style="width: 970px; margin-top: 0px; margin-right: 5px; margin-bottom: 0px; margin-left: 5px; " exited="previous">
<li class="pb-macbook" exited="previous">...</li>
<li class="pb-macbookpro" exited="previous">...</li>
...
</ul>
...
<ul class="ul-slider" page="3" style="width: 930px; margin-top: 0px; margin-right: 25px; margin-bottom: 0px; margin-left: 25px; " entered="next">
<li class="pb-keyboard started" entered="next">...</li>
<li class="pb-magicmouse started" entered="next">...</li>
<li class="pb-magictrackpad started" entered="next">...</li>
...
</ul>
Additionally, a review of the CSS () showcases various CSS3 transition/transforms properties and styles.
A snippet illustrates how different values of the entered
or exited
attributes impact the transforms, which are then animated by the transitions.
.productbrowser ul.exited ,
.productbrowser ul[exited] { display:none; }
.productbrowser li[exited] ,
.productbrowser li[toenter] { -webkit-animation-name:none; -webkit-animation-duration:0;
.productbrowser li[exited="next"] ,
.productbrowser li[toenter="next"],
.productbrowser li[enter="next"] { -webkit-transform:translate3d( 3000px, 0, 0); }
The JavaScript has been minified, making it challenging to demonstrate its functionality, but it is not overly complex.
I trust this explanation proves informative and clear :)