Results 1 to 3 of 3

Thread: URL onCLick problem in thumbnailviewer2

  1. #1
    Join Date
    Jan 2009
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post URL onCLick problem in thumbnailviewer2

    1) Script Title: thumbnailviewer2.js

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

    3) Describe problem:

    I would like to do something which seems simple, but is really a challenge for me.

    As I hover over an existing URL I want a picture to "show" on another part of the page, but I STILL want the existing URL link to work when I click on it. The URL IS NOT the same as the image used in the <a href="img"> tag

    To be more clear, I want the functionality of the thumbnailviewer loading pictures into the div "loadarea" onMouseover, but I want onClick to take me to a specified URL, not the image that is being referenced in the "a" tag.

    Is this do-able?

    Thanks!

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

    Default

    Try finding the below function inside the .js file:

    Code:
    pagelinks[i]["onclick"]=function(){ //Cancel default click action
    return false
    }
    and change that to:

    Code:
    pagelinks[i]["onclick"]=function(){ //Cancel default click action
    var linktarget=this.getAttribute("rev").split("::")[1]
    if (linktarget)
    window.location=linktarget
    return false
    }
    This causes your thumbnails when clicked on to go to a URL based on that specified inside the rev=loadarea:: attribute:

    Code:
    <a href="http://www.nasa.gov/images/content/167040main_image_feature_738_ys_4.jpg" rel="enlargeimage::mouseover" rev="loadarea::http://www.dynamicdrive.com" title="This is an example">Thumbnail Example 1</a><br />
    So with the changes, clicking on the thumbnail link will go to DD, while mousing over it will show the nasa image.
    DD Admin

  3. #3
    Join Date
    Jan 2009
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Thank You!

    You've solved my problem!

    I am so pleased. Can't thank you enough!!

    Eddie



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
  •