Results 1 to 4 of 4

Thread: Ajax Tabs Content - want images for tabs

  1. #1
    Join Date
    Sep 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Ajax Tabs Content - want images for tabs - RESOLVED

    1) Script Title:
    Ajax Tabs Content script

    2) Script URL (on DD):
    http://www.dynamicdrive.com/dynamici...tent/index.htm

    3) Describe problem:
    I want to use images instead of text for the tabs.

    My website is: http://www.attunesystems.com/ and on the left-hand side I am using the ATC script for the "News Events Case Studies" tabs which currently text.
    I want to replace the text with images that will change color (rollover) upon hover and selection.
    My current code is:
    Code:
    <li><a href="/English/News_Events/Homepage_Events.html" rel="ajaxcontentarea">Events</a></li>
    and I tried replacing it with:
    Code:
    <a href="/English/News_Events/Homepage_Events.html" rel="ajaxcontentarea" onMouseOver="MM_swapImage('events1','','/English/Images/Buttons/HP_Events_off.gif',0)"><img src="English/Images/Buttons/HP_Events_on.gif" alt="Events" border="0" width="42" height="16" name="events1" style="padding-top:10px;" /></a>
    and the result is that the external page appears in its own window instead of the div.
    I then tried using a different rollover script from Dynamic Drive instead of the Macromedia script
    Code:
    <a href="/English/News_Events/Homepage_Events.html" rel="ajaxcontentarea"><img src="English/Images/Buttons/HP_Events_off.gif" class="domroll /English/Images/Buttons/HP_Events_on.gif" border="0" /></a>
    but, the result is the same.

    So, how do I use images instead of text?

    thanks,
    dave
    Last edited by davebarnes; 09-27-2007 at 07:35 PM.

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

    Default

    The script right now assumes the tabs are contained by the LI tags- when you remove that container, the script thinks there are no tabs at all.

    Instead of simply removing the <li> element from each tab, try replacing it with another container tag, such as <span>:

    Code:
    <span><a href="/English/News_Events/Homepage_Events.html" rel="ajaxcontentarea"><img src="English/Images/Buttons/HP_Events_off.gif" class="domroll /English/Images/Buttons/HP_Events_on.gif" border="0" /></a></span>
    Then, inside ajaxtabs.js, do a search and replace, replacing all instances of "li" with "span" instead. This should do it.

  3. #3
    Join Date
    Sep 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Very helpful.

    I changed these lines in ajaxtabs.js:

    15:
    Code:
    var TabContainerType = "span" // the type of container that the tabs are in, e.g, <li>, <span>, <td>
    39:
    Code:
    var ullist=targetobj.parentNode.parentNode.getElementsByTagName(TabContainerType)
    105:
    Code:
    var ulist=ulobj.getElementsByTagName(TabContainerType) //array containing the LI elements within UL
    and now I can use any type of container for my tabs.

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

    Default

    Thanks for posting that. I'm sure it will help some other members as well.

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
  •