Results 1 to 4 of 4

Thread: Thumbnail/Enlarge Display viewer for Video Selection

  1. #1
    Join Date
    Dec 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Thumbnail/Enlarge Display viewer for Video Selection

    Hey folks, I'm wondering if you wouldn't be able to at least push me in the right direction to solve this issue.

    What I'm trying to do is have the thumbnails as buttons for video links that display a larger image when you hover your mouse over them, but that when you click either the larger image or the thumbnail you are taken to a new page, rather than opening up the larger image.

    The following DD script does everything I need it to do, outside of the thumbnail being able to link to the new page:

    Script: DD Image Thumbnail Viewer II
    http://www.dynamicdrive.com/dynamici...thumbnail2.htm

    I've tried to tweak it with hasn't been able to work and I suspect it's simply because it goes against the function of this script. Which is why I did not post in the DD Scripts thread, as I am expecting I'll need something else to do it.

    Any ideas? Thanks in advance for your help.
    Last edited by jscheuer1; 12-10-2010 at 04:18 PM. Reason: remove hotlink to commercial site

  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

    Not so different as you think. Add this to the head of your page after the external tag for the thumbnailviewer2.js script:

    Code:
    <script type="text/javascript">
    jQuery(function($){
    	$('a[rel=enlargeimage]').click(function(e){
    		var opts = {}, rev = this.rev.split(','), re = /:(?!\/\/)/;
    		for (var i = rev.length - 1; 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;
    		}
    	});
    });
    </script>
    Then, if you have a page configured to load onclick of the larger image, it will also be what loads onclick of the thumbnail image.
    - John
    ________________________

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

  3. #3
    Join Date
    Dec 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Ah, brilliant! Thank you so much, I'd been pounding my head against the wall on this for hours. It works great!

  4. #4
    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

    Here's a slightly more efficient version (does the same thing):

    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>
    - John
    ________________________

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

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
  •