I made a homepage with a full-screen slider using BXslider.js . Each image in the slider has a caption text with an anchor. After clicking on the link link, you will be redirected to one detailed page. If you go from home to the detailed page, a transition will appear. This is actually the same as the demo on the jquery.smoothstate.js page .
I ran into one problem, BXslider is broken after enabling jquery.smoothstate javascript. Each time you press the button with the prev or next arrow in BXslider, the slider itself overwrites itself and duplicates the previous / next buttons, and the images disappear. In firebug, I do not receive any warnings or errors. This makes debugging difficult. Hope someone can help me on this.
Thanks in advance!
Below you will find the code that I wrote for my site bxslider.js / smootstate.
Code for the main page
<div id="main" class="m-scene">
<div class="scene-element scene-element--fadeinup">
<section id="banner">
<div class="inner">
<div id="box">
<div class="relative-box">
<div class="logo"></div>
<h2>Client-name</h2>
<div id="captions">
<p>" This is a caption "</p>
</div>
</div>
<a href="/generic.html" class="more">To genericpage</a>
</div>
<ul class="bxslider">
<li style="background-image: url('/images/pic1.jpg');"></li>
<li style="background-image: url('/images/pic2.jpg');"></li>
<li style="background-image: url('/images/pic3');"></li>
<li style="background-image: url('/images/pic4.jpg');"></li>
<li style="background-image: url('/images/pic5.jpg');"></li>
</ul>
</div>
</section>
</div>
</div>
</div>
Universal html / css selectors
I am using generic html / selectors for jquery.smootstate.js. Below html is identical for home and detail page.
<div id="main" class="m-scene">
<div class="scene-element scene-element--fadeinup">
css3 transitions
scene element and scene element - fadeinup selectors are used to animate css3 pages.
@keyframes fadeInUp{
0%{opacity:0; transform:translate3d(0,100%,0);}
100%{opacity:1;transform:none;}
}
.m-scene .scene-element{
animation-duration: 0.25s;
transition-timing-function: ease-in;
animtation-fill-mode: both;
}
.m-scene .scene-element--fadeinup {animation-name:fadeInUp;}
.m-scene.is-exiting .scene-element {animation-direction: alternate-reverse;}
javascript for jquery.smoothstate.js
(function($) {
'use strict';
var $body = $('html, body'),
content = $('#smooth').smoothState({
onStart: {
duration: 250,
render: function (url, $container) {
content.toggleAnimationClass('is-exiting');
$body.animate({
scrollTop: 0
});
}
}
}).data('smoothState');
})(jQuery);