0

So I have this function that is supposed make some changes to an image (for a portfolio I'm making) and there is a button to change the image and there is also a timer that runs that changes the image every six seconds, however, as much as the button works 100% the timer does not, my firefox console tells me this: ReferenceError: nextone is not defined yet it is... What might be causing this?

My Script:

 function nextone() {
$("#portfolio1").fadeOut(500, function() {
    nextinline += 1;
    if(nextinline > jpgss) { nextinline = 1; }      
    $("#portfolio1").attr("src","images/portfolio/" + nextinline + ".jpg")
    $("#hyperlink").attr("href","portfolio.php?e=" + nextinline + "")
    $("#portfolio1").fadeIn(500);
    });
}
var timerr = setInterval("nextone()",6000); // Error Given on this line

1 Answer 1

1

try doing:

var timerr = setInterval(nextone,6000);

or

setInterval(function (){ 
  nextone() }, 6000);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.