SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Jul 2004
    Location
    Knoxville, TN
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Javascript Carousel IE Problem

    I'm working on a rotating "top story" kind of feature for the website I am developing and found an example online that I am modifying for mysite. Only thing is, it doesn't work properly in IE and I was wondering if anyone could figure out what needs to be done to get it to work properly. I know it has to be an issue with the javascript but I can't seem to figure it out. Basically, after it goes through it's first loop of stories, it goes blank in IE but works fine in Firefox. Here is the example.....
    http://www.builderau.com.au/resource...l/example2.htm

  2. #2
    SitePoint Member
    Join Date
    Jul 2004
    Location
    Knoxville, TN
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Anyone?

  3. #3
    SitePoint Member PbC LLC's Avatar
    Join Date
    Mar 2007
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Post your code here please

  4. #4
    SitePoint Member
    Join Date
    Jul 2004
    Location
    Knoxville, TN
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    //Javascript
    var stor = -1;
    var maxstor = 3;
    var timeout = 0;
    var lastShownStor = -1;
    
    function autorot() {
    	showNext();
    	timeout = setTimeout('autorot();', 3500);
    }
    
    
    
    function rotateDiv(stor){
    
      var divs = document.getElementById("storyContainer").getElementsByTagName("div");
      for (var i=0; i < divs.length; i++ ) {
        var div = divs[i];
        if ( (div.id != "")) {
    	   if(i != stor && i != lastShownStor){
            	   div.style.display = "none";
            	   div.style.zIndex = "1";
    	   }
    	   /*else if(i == lastShownStor && lastShownStor > -1){
    
    	   }*/
    	   else if(i != lastShownStor){
    	      if(lastShownStor > -1){	       
    	   	           document.getElementById('story'+(lastShownStor+1)).style.zIndex = "4";
    	               new Effect.DropOut(document.getElementById('story'+(lastShownStor+1)));
    	      }
    	       div.style.zIndex = "1";
    		  div.style.display = "block"; 
    		      break;
    	   }
        }
      }
      
        var spans = document.getElementById("nav").getElementsByTagName("span");
      for (var i=0; i < spans.length; i++ ) {
        var span = spans[i];
        if ( (span.id != "")) {
    	if(i != stor)
            	span.className = "none";
    	else
    		span.className = "selStory";
        }
      }
    }
    
    function showNext(){
        lastShownStor = stor;
        
    	if(stor < maxstor)
    		stor++;
    	else
    		stor=0;
    
    	rotateDiv(stor);
    }
    
    function stoprot() {
    	clearTimeout(timeout);
    }
    
    
    function showNext(){
        lastShownStor = stor;
        
    	if(stor < maxstor)
    		stor++;
    	else
    		stor=0;
    
    	rotateDiv(stor);
    }
    
    function showPrev(){
        lastShownStor = stor;
        
    	if(stor > 0)
    		stor--;
    	else
    		stor=maxstor;
    
    	rotateDiv(stor);
    }
    
    function showStoryOne(){http://admcms.v3.cnet.com.au/template/index.htm
        lastShownStor = stor;
    	stor=0;
    	rotateDiv(stor);
    }
    function showStoryTwo(){
        lastShownStor = stor;
    	stor=1;
    	rotateDiv(stor);
    }
    function showStoryThree(){
        lastShownStor = stor;
    	stor=2;
    	rotateDiv(stor);
    }
    function showStoryFour(){
        lastShownStor = stor;
    	stor=3;
    	rotateDiv(stor);
    }


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
  •