PDA

View Full Version : Resolved Image Thumbnail Viewer II - creating an extra link



europe451
12-29-2010, 02:08 AM
1) Script Title: Image Thumbnail Viewer II

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/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.


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

jscheuer1
12-29-2010, 05:08 AM
Link to what? In your example, would that be:


. . . 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:


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

europe451
12-29-2010, 03:30 PM
Yes, that is exactly what I was looking for. Thank you very much.