Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2010
    Location
    Kalamazoo MI
    Posts
    20
    Plugin Contributions
    0

    Default javascript photo rotator

    Im having a problem with javascript on my zen cart in the main page editor. I installed the code and everything works ok but there is a delay for it about 3 seconds when it first comes up with a red x. Does anyone know how to fix this I would like to remove the x.
    Here is the site
    www.musclefreaksnutrition.com

    here is the code I installed.
    <center>
    <div id="welcome">

    <SCRIPT LANGUAGE="JavaScript">
    <!--

    /*
    Script by FPMC at http://jsarchive.8m.com
    Submitted to JavaScript Kit (http://javascriptkit.com)
    For this and 400+ free scripts, visit http://javascriptkit.com
    */

    //set image paths
    src = ["../images/mass stack.jpg",
    "../images/fatloss.jpg",
    "../images/metapure.jpg",
    "../images/mass stack.jpg",
    "../images/fatloss.jpg",
    "../images/metapure.jpg",
    "../images/mass stack.jpg"]


    //set corresponding urls
    url = ["http://freewarejava.com",
    "http://javascriptkit.com",
    "http://dynamicdrive.com",
    "http://dynamicdrive.com",
    "http://dynamicdrive.com"]

    //set duration for each image
    duration = 3;

    //Please do not edit below
    ads=[]; ct=0;
    function switchAd() {
    var n=(ct+1)%src.length;
    if (ads[n] && (ads[n].complete || ads[n].complete==null)) {
    document["Ad_Image"].src = ads[ct=n].src;
    }
    ads[n=(ct+1)%src.length] = new Image;
    ads[n].src = src[n];
    setTimeout("switchAd()",duration*1000);
    }
    function doLink(){
    location.href = url[ct];
    } onload = function(){
    if (document.images)
    switchAd();
    }
    //-->
    </SCRIPT>

    <A HREF="javascript:doLink();" onMouseOver="status=url[ct];return true;"
    onMouseOut="status=''">
    <IMG NAME="Ad_Image" SRC="image1.gif" BORDER=0>
    </A>

    <p align="center"><font face="arial" size="-2"><a href="http://javascriptkit.com"></a></font></p>

    <br>
    </div>

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: javascript photo rotator

    Might be that it is having to load the js

    Try implementing the js in the ZenCart mode
    Scroll down and see the description Adding Extra Javascript to a specific page

    https://www.zen-cart.com/tutorials/index.php?article=36
    Zen-Venom Get Bitten

  3. #3
    Join Date
    Oct 2006
    Location
    Alberta, Canada
    Posts
    4,571
    Plugin Contributions
    1

    Default Re: javascript photo rotator

    If you are going to use JS then might as well use jQuery.

    With that said, may I suggest a better script?

    http://malsup.com/jquery/cycle/lite/

    There is also the bigger, better -- but still free -- version.

    http://malsup.com/jquery/cycle/


    Also, at approx. 70K ea. it's a good idea to optimize those Banners / Images.

 

 

Similar Threads

  1. Image Rotator Issues
    By newbie11 in forum General Questions
    Replies: 2
    Last Post: 12 Jan 2012, 06:13 PM
  2. image/banner rotator
    By lucianman in forum General Questions
    Replies: 5
    Last Post: 12 Nov 2011, 01:57 AM
  3. Banner Rotator
    By Berserker in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 21 Jun 2009, 07:53 PM
  4. Template Rotator Mod
    By Therose in forum All Other Contributions/Addons
    Replies: 12
    Last Post: 24 May 2008, 01:02 AM

Posting Permissions

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