PDA

View Full Version : Image Thumbnail Viewer II Question



JohnnyWeb
07-14-2010, 09:33 PM
1) Script Title: Image Thumbnail Viewer II

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

3) Describe problem: I have set everything up, and it works great in all browsers. I have set it up so that when you hover over a thumbnail, an enlarged image appears. I have also linked the larger image to a specific page.

My question is, how do I link the thumbnail so that it goes to a webpage I specify, and not to an enlarged copy of the image on another page. I would like for it to be;

Hover over thumb = enlarged image appears next to thumb
click on thumb = takes you to a specific url instead of large image.

If that cannot be done, how do I at least deaden the click feature. It would be better for me to not have the click feature work at all with the thumbnail than for it to go to the larger image page.

Thanks,
Johnny

azoomer
07-14-2010, 10:49 PM
Hi Johnny
I played a round with this issue and the only thing I could come up with was a way to disable the clicks. I put this snippet in the head section

<script type="text/javascript">
jQuery(document).ready(function($) {
$('.noclick').click(function(){
return false;
});
});
</script>
and then assigned a class called
class="noclick"
to the links I wanted to disable, like this

<a href="http://www.nasa.gov/images/content/167040main_image_feature_738_ys_4.jpg"
class="noclick" rel="enlargeimage" rev="targetdiv:loadarea,link:http://cnn.com"
title="The Universe is just waiting to be explored">
<img src="thumbnail.jpg" width="31" height="31" alt="thumb" />
</a>
Adding the part with the blue highlight will link the larger image to a page of choice.

JohnnyWeb
07-16-2010, 05:05 PM
This worked out perfectly. Thank you very much.

On another note:

I have it setup so that a large image of my choice is open by default when the page is opened is there any way that I can have the large images rotate on their own?

Thanks,
John

jscheuer1
07-17-2010, 11:44 AM
Hi Johnny
I played a round with this issue and the only thing I could come up with was a way to disable the clicks. I put this snippet in the head section

<script type="text/javascript">
jQuery(document).ready(function($) {
$('.noclick').click(function(){
return false;
});
});
</script>
and then assigned a class . . .

You could just do:


jQuery(function($){
$('a[rel^=enlargeimage]').click(function(e){
e.preventDefault();
});
});

and not need the class. The preventDefault() method is ordinarily of no use in IE. But jQuery makes it work there and in all modern browsers. It has an advantage over (really just a difference from) return false in jQuery, allowing the click event to bubble up. This has no immediate relevance here. Depending on what all else might be done with the rest of the page though, it could.

azoomer
07-17-2010, 11:53 AM
jQuery(function($){
$('a[rel^=enlargeimage]').click(function(e){
e.preventDefault();
});
});

Thanks for the info. It's definitely a lot easier to do it that way