TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 09-04-2009, 11:12 PM   #1 (permalink)
The Addict
 
Enfernikus's Avatar
 
Join Date: Jun 2008
Posts: 335
Thanks: 2
Enfernikus is on a distinguished road
Default Quite stuck

I'm using jFlow and adding on my own auto-start ( which to my knowledge it does not support ) now I've tried using the setTimeout method on a function which set's yet another setTimeout ( In order to keep it running the function ) how ever, it only ever runs once.

The method in question is slideToNextTimeout

javascript Code:
/* Copyright (c) 2008 Kean Loong Tan [url]http://www.gimiti.com/kltan[/url]
 * Licensed under the MIT ([url]http://www.opensource.org/licenses/mit-license.php[/url])
 * jFlow
 * Version: 1.2 (July 7, 2008)
 * Requires: jQuery 1.2+
 */

 
(function($) {

    $.fn.jFlow = function(options) {
        var opts = $.extend({}, $.fn.jFlow.defaults, options);
        var randNum = Math.floor(Math.random()*11);
        var jFC = opts.controller;
        var jFS =  opts.slideWrapper;
        var jSel = opts.selectedWrapper;
        var time;

        var cur = 0;
        var maxi = $(jFC).length;
        // sliding function
        var slide = function (dur, i) {
            $(opts.slides).children().css({
                overflow:"hidden"
            });
            $(opts.slides + " iframe").hide().addClass("temp_hide");
            $(opts.slides).animate({
                marginLeft: "-" + (i * $(opts.slides).find(":first-child").width() + "px")},
                opts.duration*(dur),
                opts.easing,
                function(){
                    $(opts.slides).children().css({
                        overflow:"auto"
                    });
                    $(".temp_hide").show();
                }
            );
           
        }
       
        var slideToNext = function(){
            if ($(opts.slides).is(":not(:animated)")) {
                var dur = 1;
                if (cur < maxi - 1)
                    cur++;
                else {
                    cur = 0;
                    dur = maxi -1;
                }
                $(jFC).removeClass(jSel);
                slide(dur, cur);
                $(jFC).eq(cur).addClass(jSel);
            }
        }
       
        var clearTime = function(){
            clear_timeout(time);
        }
       
        var slideToNextTimeout = function(){
            slideToNext();
            time = setTimeout('slideToNextTimeout()', 1000);
        }
       
        $(this).find(jFC).each(function(i){
            $(this).click(function(){
                if ($(opts.slides).is(":not(:animated)")) {
                    $(jFC).removeClass(jSel);
                    $(this).addClass(jSel);
                    var dur = Math.abs(cur-i);
                    slide(dur,i);
                    cur = i;
                }
            });
        })
       
        $(opts.slides).before('<div id="'+jFS.substring(1, jFS.length)+'"></div>').appendTo(jFS);
       
        $(opts.slides).find("div").each(function(){
            $(this).before('<div class="jFlowSlideContainer"></div>').appendTo($(this).prev());
        });
       
        //initialize the controller
        $(jFC).eq(cur).addClass(jSel);
       
        var resize = function (x){
            $(jFS).css({
                position:"relative",
                width: opts.width,
                height: opts.height,
                overflow: "hidden"
            });
            //opts.slides or #mySlides container
            $(opts.slides).css({
                position:"relative",
                width: $(jFS).width()*$(jFC).length+"px",
                height: $(jFS).height()+"px",
                overflow: "hidden"
            });
            // jFlowSlideContainer
            $(opts.slides).children().css({
                position:"relative",
                width: $(jFS).width()+"px",
                height: $(jFS).height()+"px",
                "float":"left",
                overflow:"auto"
            });
           
            $(opts.slides).css({
                marginLeft: "-" + (cur * $(opts.slides).find(":eq(0)").width() + "px")
            });
        }
       
        // sets initial size
        resize();

        // resets size
        $(window).resize(function(){
            resize();                   
        });
       
       
        $(opts.prev).click(function(){
            if ($(opts.slides).is(":not(:animated)")) {
                var dur = 1;
                if (cur > 0)
                    cur--;
                else {
                    cur = maxi -1;
                    dur = cur;
                }
                $(jFC).removeClass(jSel);
                slide(dur,cur);
                $(jFC).eq(cur).addClass(jSel);
            }
        });
       
        $(opts.next).click(slideToNext);
    };
   
    $.fn.jFlow.defaults = {
        controller: ".jFlowControl", // must be class, use . sign
        slideWrapper : "#jFlowSlide", // must be id, use # sign
        selectedWrapper: "jFlowSelected"// just pure text, no sign
        easing: "swing",
        duration: 400,
        width: "100%",
        prev: ".jFlowPrev", // must be class, use . sign
        next: ".jFlowNext" // must be class, use . sign
    };
   
})(jQuery);
__________________
My Blog
Enfernikus is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Stuck on what to do ReSpawN General 2 10-13-2008 05:44 PM
Building Template and Stuck... Help? oscargodson Advanced PHP Programming 3 08-26-2008 04:11 AM
Stuck on a bug [Youtube RSS Grabber] - Credit to person! codefreek Absolute Beginners 2 07-19-2008 05:06 PM
Math Help -.-..I'm stuck geometry question Nor The Lounge 4 03-28-2008 11:05 PM


All times are GMT. The time now is 02:25 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design