Results 1 to 5 of 5

Thread: Thumbnail Viewer 2: disable click and thumbnail alpha

  1. #1
    Join Date
    Sep 2010
    Posts
    2
    Thanks
    0
    Thanked 1 Time in 1 Post

    Question Thumbnail Viewer 2: disable click and thumbnail alpha

    1) Script Title: Image Thumbnail Viewer II

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

    3) Describe problem:
    I've already searched for the answer, but haven't been able to find it. In addition, the code was recently updated. I am working with the May 2010 code. Two questions:

    1. I was able to get the code working and am using the default setting of having the large image show onmouseover. However, when the user clicks on the thumbnail, the user is linked to the jpg of the large image (in the same window). This is how it set to function as you can see in the demo at the URL listed above.

    I understand why this does it since the image path is contained within the "a href" tag. Is there a simple solution to disabling this? I do not want the user clicking off the page to the large image file.

    2. I've set the thumbnail images to a lower alpha (opacity). What is the best method for having the thumbnail image alpha to increase onmouseover and then to reset?

    Thanks in advance.

  2. The Following User Says Thank You to seyoo For This Useful Post:

    Manhattan (10-20-2010)

  3. #2
    Join Date
    Sep 2010
    Posts
    1
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default I'm a noob so can't really answer your second question

    For your first question I was actually searching for the answer just this past hour and was googling around, that's how I found your post. Been trying to figure out how to make it so it doesn't go to the link, then I started googling disabling a link and what not, and finally figured out how to do it.

    Just add onclick="return false;" to your a href and it'll disable the default action when clicked.

    http://www.faqs.org/docs/htmltut/lin...A_onClick.html

  4. The Following User Says Thank You to Ashoro For This Useful Post:

    Manhattan (10-20-2010)

  5. #3
    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

    For both, add this script to the head of the page:

    Code:
    <script type="text/javascript">
    jQuery(function($){
    	var initialOpacity = 0.6;
    	$('a[rel=enlargeimage]').css({opacity: initialOpacity}).click(function(e){
    		e.preventDefault();
    	}).hover(function(){
    		$(this).stop(true, true).animate({opacity: 1});
    	}, function(){
    		$(this).stop(true, true).animate({opacity: initialOpacity});
    	});
    });
    </script>
    Place it after the other two from Step 1 on the demo page. Configure the initial opacity in the highlighted area as shown.
    Last edited by jscheuer1; 09-14-2010 at 04:27 AM. Reason: elaborate
    - John
    ________________________

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

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

    Manhattan (10-20-2010)

  7. #4
    Join Date
    Sep 2010
    Posts
    2
    Thanks
    0
    Thanked 1 Time in 1 Post

    Question buggy funcationality

    Quote Originally Posted by jscheuer1 View Post
    For both, add this script to the head of the page:
    Thanks, but the code doesn't quite function the way I would like it to. I don't have an example to show you online because I'm still testing and developing locally, but the alpha doesn't change on the initial mouseover.

    To clarify, the user rolls over the thumbnail -> large image shows. If the user stops, nothing happens. If the user moves again (still over the same thumbnail -never a mouseout), then the alpha state of the thumbnail changes.

    I would like both the larger image reveal and the thumbnail alpha change (<100 onmouseover) to happen simultaneously if possible. Any ideas?

    Thanks again.

  8. #5
    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

    You want the thumbnail to fade out onmouseover?
    - John
    ________________________

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

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

    Manhattan (10-20-2010)

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
  •