Looping through image with the lenght property and its not looping
up vote
-3
down vote
favorite
It stops at the last image but I want it to run infinitely, but it won't loop it stops at the end of the last .img item
function slider(){
var sc = $(".sect .img").length;
var count = 1;
setInterval(function(){
$(".sect #"+ count).delay(3500);
$(".sect #"+ count).fadeIn(3500);
$(".sect #"+ count).delay(5500);
$(".sect #"+ count).fadeOut(3500);
if(count !== sc){
count = count + 1;
}else{
count = 1;
}
} 12500);
};
jquery
add a comment |
up vote
-3
down vote
favorite
It stops at the last image but I want it to run infinitely, but it won't loop it stops at the end of the last .img item
function slider(){
var sc = $(".sect .img").length;
var count = 1;
setInterval(function(){
$(".sect #"+ count).delay(3500);
$(".sect #"+ count).fadeIn(3500);
$(".sect #"+ count).delay(5500);
$(".sect #"+ count).fadeOut(3500);
if(count !== sc){
count = count + 1;
}else{
count = 1;
}
} 12500);
};
jquery
1
see meta.stackoverflow.com/questions/285551/…
– Moshe Slavin
Nov 7 at 15:09
do not post code as image, it's terrible to see and terrible to debug. Edit your question and add or acode blockby pressingCTRL+Kor a snippet (CTRL+M) with your current code.
– Calvin Nunes
Nov 7 at 16:41
add a comment |
up vote
-3
down vote
favorite
up vote
-3
down vote
favorite
It stops at the last image but I want it to run infinitely, but it won't loop it stops at the end of the last .img item
function slider(){
var sc = $(".sect .img").length;
var count = 1;
setInterval(function(){
$(".sect #"+ count).delay(3500);
$(".sect #"+ count).fadeIn(3500);
$(".sect #"+ count).delay(5500);
$(".sect #"+ count).fadeOut(3500);
if(count !== sc){
count = count + 1;
}else{
count = 1;
}
} 12500);
};
jquery
It stops at the last image but I want it to run infinitely, but it won't loop it stops at the end of the last .img item
function slider(){
var sc = $(".sect .img").length;
var count = 1;
setInterval(function(){
$(".sect #"+ count).delay(3500);
$(".sect #"+ count).fadeIn(3500);
$(".sect #"+ count).delay(5500);
$(".sect #"+ count).fadeOut(3500);
if(count !== sc){
count = count + 1;
}else{
count = 1;
}
} 12500);
};
jquery
jquery
edited Nov 7 at 18:21
asked Nov 7 at 15:01
onyima ogochukwu
12
12
1
see meta.stackoverflow.com/questions/285551/…
– Moshe Slavin
Nov 7 at 15:09
do not post code as image, it's terrible to see and terrible to debug. Edit your question and add or acode blockby pressingCTRL+Kor a snippet (CTRL+M) with your current code.
– Calvin Nunes
Nov 7 at 16:41
add a comment |
1
see meta.stackoverflow.com/questions/285551/…
– Moshe Slavin
Nov 7 at 15:09
do not post code as image, it's terrible to see and terrible to debug. Edit your question and add or acode blockby pressingCTRL+Kor a snippet (CTRL+M) with your current code.
– Calvin Nunes
Nov 7 at 16:41
1
1
see meta.stackoverflow.com/questions/285551/…
– Moshe Slavin
Nov 7 at 15:09
see meta.stackoverflow.com/questions/285551/…
– Moshe Slavin
Nov 7 at 15:09
do not post code as image, it's terrible to see and terrible to debug. Edit your question and add or a
code block by pressing CTRL+K or a snippet (CTRL+M) with your current code.– Calvin Nunes
Nov 7 at 16:41
do not post code as image, it's terrible to see and terrible to debug. Edit your question and add or a
code block by pressing CTRL+K or a snippet (CTRL+M) with your current code.– Calvin Nunes
Nov 7 at 16:41
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53192088%2flooping-through-image-with-the-lenght-property-and-its-not-looping%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
see meta.stackoverflow.com/questions/285551/…
– Moshe Slavin
Nov 7 at 15:09
do not post code as image, it's terrible to see and terrible to debug. Edit your question and add or a
code blockby pressingCTRL+Kor a snippet (CTRL+M) with your current code.– Calvin Nunes
Nov 7 at 16:41