Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- //custom
- var item = ".feature-box";
- var in_anim = 'bounceInDown';
- var out_anim = 'bounceOutLeft';
- var duration = 4000;
- var timeout_to_next = 500;
- //helper
- var canchange = false;
- var current = 0;
- var all = $(item).children();
- var cycle = [];
- all.each(function(i){
- cycle[i] = $(this);
- $(this).css('display','none');
- });
- cycle[current].css('display', 'block');
- setInterval(function(){
- canchange = true;
- cycle[current].removeClass('animated '+in_anim);
- cycle[cycle.length-1].removeClass('animated '+out_anim);
- cycle[current].addClass('animated '+out_anim);
- setTimeout(function(){
- cycle[current].css('display', 'none');
- if (current == cycle.length-1) {
- current = 0;
- } else {
- current++;
- }
- cycle[current].css('display', 'block');
- }, timeout_to_next);
- if (current < 2) {
- cycle[current+1].addClass('animated '+in_anim);
- } else {
- cycle[0].addClass('animated '+in_anim);
- reset();
- }
- }, duration);
- function reset() {
- for (var a = 0; a < cycle.length; a++){
- cycle[a].removeClass('animated '+out_anim);
- }
- cycle[cycle.length-1].addClass('animated '+out_anim);
- cycle[0].addClass('animated '+in_anim);
- }
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement