SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Wizard trampt's Avatar
    Join Date
    Jan 2003
    Location
    Los Angeles, CA
    Posts
    1,997
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    two image rollover scripts not working together

    First off I don't know much about Javascript besides what I can edit in a premade script. I am using one external javascript to control the menu rollovers, and then on each portfolio page I have a similar script to make the images in each portfolio section rollover.

    I changed most of the portfolio script so that it doesn't use the same function name, array names, etc. However only the portfolio rollovers work, and the menu rollovers don't. If anyone can help I would appreciate it.

    EDIT - link removed after fixed
    Last edited by trampt; May 5, 2004 at 13:12.

  2. #2
    American't awestmoreland's Avatar
    Join Date
    Sep 2002
    Location
    Grand Rapids, MI
    Posts
    1,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The first thing I notice is that you have two functions called on() and two functions called off().

    Does all that NN3 stuff refer to Netscape Navigator 3? Surely you don't want to keep all that in do you? The code could be tidied up a lot if it were removed and I think if anyone is still using NN3 then I think they're beyond help


    Andy
    From the English nation to a US location.

  3. #3
    SitePoint Wizard trampt's Avatar
    Join Date
    Jan 2003
    Location
    Los Angeles, CA
    Posts
    1,997
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by awestmoreland
    Does all that NN3 stuff refer to Netscape Navigator 3? Surely you don't want to keep all that in do you? The code could be tidied up a lot if it were removed and I think if anyone is still using NN3 then I think they're beyond help
    I imagine it does have something to with Netscape 3, however when I removed it the script stopped working. I also tried changing the function to on2 & off2 to seperate but that didn't work.

    Any help you could give would be great.

  4. #4
    American't awestmoreland's Avatar
    Join Date
    Sep 2002
    Location
    Grand Rapids, MI
    Posts
    1,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this: DEMO

    While I've tried to keep the structure of your code intact as much as possible, this is a bit of a rewrite of the function so bear with me while I try to remember what I did:
    • Removed the call to the external javascript function and inserted the necessary bits of it inside the main page. All the javascript can be exported to an external file now if you prefer.
    • Removed multiple occurrences of on()/off() functions and combined both the button mouseOvers and portfolio mouseOvers within the same functions.
    • Changed the menu's onMouseOver to be on the image rather than the surrounding link.
    • Removed the "name" of the image and gave it an "id" instead.
    • The first thing that on() and off() do is to check the first five characters of "id" which has been passed and then changes an image based on the result. This could be made simpler still if you adopted the same naming convention for both menu and portfolio graphics i.e. "alt" or no "alt" in the names of both.
    If I was going to rewrite this from scratch, I'd have probably used plain text links with CSS mouseOvers, but there's not too much overhead as your buttons are small and few.

    Give me a shout if anything needs clarifying.


    Andy
    From the English nation to a US location.

  5. #5
    American't awestmoreland's Avatar
    Join Date
    Sep 2002
    Location
    Grand Rapids, MI
    Posts
    1,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I should have also mentioned that if you're going to simply cut & paste the code from my demo, then you should really remove the "<base href=..." line in the header.


    Andy
    From the English nation to a US location.

  6. #6
    SitePoint Wizard trampt's Avatar
    Join Date
    Jan 2003
    Location
    Los Angeles, CA
    Posts
    1,997
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I appreciate all your help and I have made the change to the site and reuploaded, however this code only seems to work in IE on PC. It doesn't work in any browser I try on the Mac including IE.

    It's probably something I did but I can't seem to find where it is failing?

  7. #7
    SitePoint Wizard trampt's Avatar
    Join Date
    Jan 2003
    Location
    Los Angeles, CA
    Posts
    1,997
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Andy, thanks for you help but I went back to my original code and just rewrote the function to use "zoomon" and "zoomoff" instead of on and off and if works fine on all browsers and platforms.

  8. #8
    American't awestmoreland's Avatar
    Join Date
    Sep 2002
    Location
    Grand Rapids, MI
    Posts
    1,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Fair enough. As long as you're happy
    From the English nation to a US location.


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
  •