- This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
-
AuthorPosts
-
July 30, 2016 at 9:22 am #244061
finalfantasy1st
ParticipantPlease! … why the loop setInterval not working in this code,it pass just one time , no loop:
$(document).ready(function(){ $('.ImageContainer').animate({opacity:'1'}, 1000, 'linear'); function pseuido(){ $('.psuedoAlternativeOne, .psuedoAlternativeTwo, .psuedoAlternativeThree, .psuedoAlternativeFour').css('backgroundImage','url(../images/3.jpg)'); }; function changeImage(){ $('.one, .two, .three, .four').css('backgroundImage','url(../images/2.jpg)'); pseuido(); }; function ImageAnimator(){ $('.one, .three').css('animation','ToTopImageAnimator 0.65s 0s 1 linear backwards'); $('.two, .four').css('animation','ToBottomImageAnimator 0.65s 0s 1 linear backwards'); $(this).delay(660).queue(function(){ changeImage(); }); }; setInterval(ImageAnimator,7000); });
July 31, 2016 at 2:45 am #244067finalfantasy1st
ParticipantThank you for your efforts, I’m trying to make a sliding image show,
the code still not complete yet.HTML: <div class="ImageContainer"> <div class="Parts one"> <div class="psuedoAlternativeOne"></div> </div> <div class="Parts two"> <div class="psuedoAlternativeTwo"></div> </div> <div class="Parts three"> <div class="psuedoAlternativeThree"></div> </div> <div class="Parts four"> <div class="psuedoAlternativeFour"></div> </div> </div>
CSS: body{ text-align: center; } .ImageContainer{ position:relative; margin-left: auto; margin-right: auto; width:600px; height: 400px; background-size: cover; z-index: 1000; overflow: hidden; border-radius: 1vw; opacity: 0; } .Parts{ position: relative; float:left; background-image: url(../images/1.jpg); background-repeat: no-repeat; background-origin: padding-box; width:150px; height: 400px; } ul{ list-style-type: none; } .one{ background-position: 0; } .two{ background-position:-150px; } .three{ background-position: -300px; } .four{ background-position: -450px; } .psuedoAlternativeOne{ position: relative; top:400px; left: 0; width:150px; height: 400px; background-image: url(../images/2.jpg); background-position:0px; background-repeat: no-repeat; background-origin: padding-box; } .psuedoAlternativeTwo{ position: relative; top:-400px; left: 0; width:150px; height: 400px; background-image: url(../images/2.jpg); background-position:-150px; background-repeat: no-repeat; background-origin: padding-box; } .psuedoAlternativeThree{ position: relative; top:400px; left: 0; width:150px; height: 400px; background-image: url(../images/2.jpg); background-position:-300px; background-repeat: no-repeat; background-origin: padding-box; } .psuedoAlternativeFour{ position: relative; top:-400px; left: 0; width:150px; height: 400px; background-image: url(../images/2.jpg); background-position:-450px; background-repeat: no-repeat; background-origin: padding-box; } @keyframes ToTopImageAnimator { 0%{ top: 0; } 100%{ top: -400px; } } @keyframes ToBottomImageAnimator { 0%{ top: 0; } 100%{ top: 400px; } }
JS: "Use Strict"; $(document).ready(function(){ $('.ImageContainer').animate({opacity:'1'}, 1000, 'linear'); function pseuido(){ $('.psuedoAlternativeOne, .psuedoAlternativeTwo, .psuedoAlternativeThree, .psuedoAlternativeFour').css('backgroundImage','url(../images/3.jpg)'); }; function changeImage(){ $('.one, .two, .three, .four').css('backgroundImage','url(../images/2.jpg)'); pseuido(); }; function ImageAnimator(){ $('.one, .three').css('animation','ToTopImageAnimator 0.65s 0s 1 linear backwards'); $('.two, .four').css('animation','ToBottomImageAnimator 0.65s 0s 1 linear backwards'); $(this).delay(660).queue(function(){ changeImage(); }); }; setInterval(ImageAnimator,7000); });
4shared file:
http://www.4shared.com/get/4KLmVnLYba/Index.htmlplease see if you can find the wrong
July 31, 2016 at 5:37 am #244069finalfantasy1st
ParticipantOh, I solved the issue!
I must reset the animation function!
$(‘.one, .three’).css(‘animation’,’ToTopImageAnimator 0.65s 0s 1 linear backwards’);
$(‘.two, .four’).css(‘animation’,’ToBottomImageAnimator 0.65s 0s 1 linear backwards’);
$(this).delay(660).queue(function(){
changeImage();
$(‘.one, .three’).css(‘animation’,”);
$(‘.two, .four’).css(‘animation’,”);
$(this).dequeue(); -
AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)
- The forum ‘Back End’ is closed to new topics and replies.