Home > DeveloperSection > Forums > Call function in custom function
Simons Hood
Simons Hood

Total Post:70

Posted on    May-03-2013 3:06 AM

 MSSQL Server MSSQL Server 

 1 Reply(s)
 847  View(s)
Rate this:
Hi Everyone!

I'm trying to figure out how this custom jQuery functions work by experimenting a bit. I can't however get it to work properly. I'm trying to call the prepareSlide 

function in my setInterval but it says prepareSlide is not defined

        start: 1,
        carousel: true
$.fn.itemSlider = function (details) {
    var currentSlideNumber = (details && details.start > 0) ? details.start : 1;
    this.prepareSlide = function(slideNumber) {
    //Set an interval
    var itemToSlide = currentSlideNumber + 1;
    slideTimer = setInterval("prepareSlide(" + itemToSlide + ")", 5000);

Please help me!
Thanks in advance!


Total Post:604

Posted on    May-03-2013 9:11 AM

Hi Samuel!

Also, to provide the context properly to the function invocation, a quick method is to preserve this by having another variable reference it, which in this case, we call self

var self = this;

slideTimer = setInterval(function(){
}, 5000);

Don't want to miss updates? Please click the below button!

Follow MindStick