Results 1 to 3 of 3

Thread: Image Thumbnail Viewer II - creating an extra link

  1. #1
    Join Date
    Apr 2010
    Posts
    58
    Thanks
    5
    Thanked 1 Time in 1 Post

    Default Image Thumbnail Viewer II - creating an extra link

    1) Script Title: Image Thumbnail Viewer II

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

    3) Describe problem: Script is working great, exactly how it should. I want to do a little more with it.

    Right now I have it set up to where the effect happens on the mouse-over. I still want that to happen, however I also want to be able to click on the thumbnail - which would be a link to a different page/site.

    HTML Code:
    <a href=".../img/books/book1.jpg" rel="enlargeimage" rev="targetdiv:bookloadarea1, link:http://www.amazon.com/book1"><img src=".../img/books/thumb_book1.jpg" /></a>
    Last edited by europe451; 12-30-2010 at 10:47 PM.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,069
    Thanks
    44
    Thanked 3,216 Times in 3,178 Posts
    Blog Entries
    12

    Default

    Link to what? In your example, would that be:

    Code:
     . . . age" rev="targetdiv:bookloadarea1, link:http://www.amazon.com/book1"><img src=".../img/books/thumb_book1.jpg" /></a>
    If so, just add this script to the head of the page:

    Code:
    <script type="text/javascript">
    jQuery(function($){
    	var re = /:(?!\/\/)/;
    	$('a[rel=enlargeimage]').click(function(e){
    		var opts = {}, rev = this.rev.split(','), i = rev.length - 1;
    		for (i; i > -1; --i){
    			rev[i] = rev[i].split(re);
    			opts[$.trim(rev[i][0])] = $.trim(rev[i][1]);
    			if(opts.link){
    				e.preventDefault();
    				location.href = opts.link;
    				return;
    			}
    		}
    	});
    });
    </script>
    If you have something else in mind, let me know.
    - John
    ________________________

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

  3. The Following User Says Thank You to jscheuer1 For This Useful Post:

    europe451 (12-29-2010)

  4. #3
    Join Date
    Apr 2010
    Posts
    58
    Thanks
    5
    Thanked 1 Time in 1 Post

    Default

    Yes, that is exactly what I was looking for. Thank you very much.

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
  •