Results 1 to 2 of 2

Thread: Iframe scroller stops working

  1. #1
    Join Date
    May 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Iframe scroller stops working

    1) Script Title: IFrame Scroller

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...e-scroller.htm

    3) Describe problem: I've been using this script for some time and I love it. But sometimes just out of the blue the scroller stops working on our homepage. I never had this problem until we changed servers last year. We are running on a Windows 2008 standard server. The scroller stopped working today. You can see it at http://www.calhoun.edu/index.html

    If I just open the file from windows explorer into my browser it works, but when I actually type in the url, it doesn't work. We have had this happen several times over the last year. Sometimes it will just start working for no apparent reason. I have had our IT department reboot the server and it has worked sometimes but not always. I have also had it where it wouldn't work on our main page but if I saved it with a different name, it would work, but not today. I have another javascript running on the page so I don't know if it conflicts but they have been running together. I just need help. Thanks so much.

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    At a glance I don't see the scroller on your page. But just in general, the iframe ticker fires when everything inside external.htm has fully loaded. If something in that external page stalls as far as it loading, then the script may never fire. One solution may be to change the script so it fires as soon as the DOM has loaded, instead of the contents themselves. To do this, inside your external.htm file, replace the original script at the bottom:

    Code:
    <script type="text/javascript">
    
    /***********************************************
    * IFRAME Scroller script- � Dynamic Drive DHTML code library (www.dynamicdrive.com)
    * This notice MUST stay intact for legal use
    * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
    ***********************************************/
    
    //Specify speed of scroll. Larger=faster (ie: 5)
    var scrollspeed=cache=2
    
    //Specify intial delay before scroller starts scrolling (in miliseconds):
    var initialdelay=500
    
    function initializeScroller(){
    dataobj=document.all? document.all.datacontainer : document.getElementById("datacontainer")
    dataobj.style.top="5px"
    setTimeout("getdataheight()", initialdelay)
    }
    
    function getdataheight(){
    thelength=dataobj.offsetHeight
    if (thelength==0)
    setTimeout("getdataheight()",10)
    else
    scrollDiv()
    }
    
    function scrollDiv(){
    dataobj.style.top=parseInt(dataobj.style.top)-scrollspeed+"px"
    if (parseInt(dataobj.style.top)<thelength*(-1))
    dataobj.style.top="5px"
    setTimeout("scrollDiv()",40)
    }
    
    if (window.addEventListener)
    window.addEventListener("load", initializeScroller, false)
    else if (window.attachEvent)
    window.attachEvent("onload", initializeScroller)
    else
    window.onload=initializeScroller
    
    
    </script>
    with this version instead:

    Code:
    <script type="text/javascript">
    
    /***********************************************
    * IFRAME Scroller script- ? Dynamic Drive DHTML code library (www.dynamicdrive.com)
    * This notice MUST stay intact for legal use
    * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
    ***********************************************/
    
    //Specify speed of scroll. Larger=faster (ie: 5)
    var scrollspeed=cache=2
    
    //Specify intial delay before scroller starts scrolling (in miliseconds):
    var initialdelay=500
    
    if (typeof dd_domreadycheck=="undefined") //global variable to detect if DOM is ready
    var dd_domreadycheck=false
    
    function initializeScroller(){
    dataobj=document.all? document.all.datacontainer : document.getElementById("datacontainer")
    dataobj.style.top="5px"
    setTimeout("getdataheight()", initialdelay)
    }
    
    function getdataheight(){
    thelength=dataobj.offsetHeight
    if (thelength==0)
    setTimeout("getdataheight()",10)
    else
    scrollDiv()
    }
    
    function scrollDiv(){
    dataobj.style.top=parseInt(dataobj.style.top)-scrollspeed+"px"
    if (parseInt(dataobj.style.top)<thelength*(-1))
    dataobj.style.top="5px"
    setTimeout("scrollDiv()",40)
    }
    
    function domready(functionref){ //based on code from the jQuery library
    	if (dd_domreadycheck){
    		functionref()
    		return
    	}
    	// Mozilla, Opera and webkit nightlies currently support this event
    	if (document.addEventListener) {
    		// Use the handy event callback
    		document.addEventListener("DOMContentLoaded", function(){
    			document.removeEventListener("DOMContentLoaded", arguments.callee, false )
    			functionref();
    			dd_domreadycheck=true
    		}, false )
    	}
    	else if (document.attachEvent){
    		// If IE and not an iframe
    		// continually check to see if the document is ready
    		if ( document.documentElement.doScroll && window == window.top) (function(){
    			if (dd_domreadycheck) return
    			try{
    				// If IE is used, use the trick by Diego Perini
    				// http://javascript.nwbox.com/IEContentLoaded/
    				document.documentElement.doScroll("left")
    			}catch(error){
    				setTimeout( arguments.callee, 0)
    				return;
    			}
    			//and execute any waiting functions
    			functionref();
    			dd_domreadycheck=true
    		})();
    	}
    	if (document.attachEvent && parent.length>0) //account for page being in IFRAME, in which above doesn't fire in IE
    		this.addEvent([window], function(){functionref()}, "load");
    }
    
    domready(initializeScroller)
    
    </script>
    DD Admin

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •