Results 1 to 2 of 2

Thread: Image Thumbnail Viewer II: Way to Prevent linking to actual image URL's?

  1. #1
    Join Date
    Oct 2009
    Posts
    20
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Image Thumbnail Viewer II: Way to Prevent linking to actual image URL's?

    1) Script Title: Image Thumbnail Viewer II

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

    3) Describe problem:

    Is there a way to prevent a hard-link (not sure what the best term would be) from happening when a user clicks on an image that uses the hover action to change the main image?

    My code looks like this:

    HTML Code:
    <div id="loadarea">
    <img src="productimages/image1.jpg"/>
    </div>
    
    <div id="productThumbs">
    <a href="productimages/image1.jpg" rel="enlargeimage" rev="targetdiv:loadarea"><img src="productimages/image1.jpg"/></a>
    <a href="productimages/image2.jpg" rel="enlargeimage" rev="targetdiv:loadarea"><img src="productimages/image2.jpg"/></a>
    <a href="productimages/image3.jpg" rel="enlargeimage" rev="targetdiv:loadarea"><img src="productimages/image3.jpg"/></a>
    </div>
    And all works as it should, meaning the main image changes when the user hovers over the thumbs, but i would prefer it if they couldn't also click the image, which takes them to the actual image URL....

    Is there a way to prevent this, either by tweaking the HTML here, or changing a setting in the javascript or css?

    Thanks in advance of any help

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Put this in the head of the page after the scripts for the viewer:

    Code:
    <script type="text/javascript">
    jQuery(function($){
    	$('a[rel="enlargeimage"]').click(function(e){
    		e.preventDefault()
    	});
    });
    </script>
    The browser cache may need to be cleared and/or the page refreshed to see changes.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Similar Threads

  1. Resolved Loading larger image on page load, image thumbnail viewer 2
    By Lucy92 in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 11-24-2010, 10:38 PM
  2. Image Thumbnail Viewer II - Linking Enlarged To New Window/Tab
    By Rezinunts in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 07-21-2009, 08:52 AM
  3. Linking with CSS Popup Image Viewer.
    By adamburton in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 09-09-2008, 02:48 PM
  4. image thumbnail viewer II (set image sizes, default image)
    By ramtanion in forum Dynamic Drive scripts help
    Replies: 7
    Last Post: 05-07-2008, 12:26 AM
  5. Cross Browser Fade With Default Image--Image Thumbnail Viewer II
    By johnwboyd in forum Dynamic Drive scripts help
    Replies: 6
    Last Post: 04-12-2008, 03:26 PM

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
  •