Results 1 to 2 of 2

Thread: enabletitle:no in Image Thumbnail Viewer II

  1. #1
    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 enabletitle:no in Image Thumbnail Viewer II

    1) Script Title: Image Thumbnail Viewer II

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

    3) Describe problem: If we set enabletitle:no in the rev attribute of a trigger, the title of that link is still shown as a description/caption of the enlarged image. This is in contradiction of (from the demo page):

    enabletitle: yes|no "yes" enabletitle is set to "yes" by default, with the effect being that if your thumbnail link carries a "title" attribute, the script will use that to show a description beneath the enlarged image:

    <a href="myimages/first.jpg" title="This is a picture of my dog!" rel="enlargeimage" rev="targetdiv:loadarea">Thumbnail</a>

    To stop a description from showing, either set enabletitle to "no" or simply remove the "title" attribute from the thumbnail.
    That's because of this highlighted line in the script:

    Code:
    /*Image Thumbnail Viewer II (May 19th, 2010)
    * This notice must stay intact for usage 
    * Author: Dynamic Drive at http://www.dynamicdrive.com/
    * Visit http://www.dynamicdrive.com/ for full source code
    */
    
    jQuery.noConflict()
    
    jQuery.thumbnailviewer2={
    		loadmsg: '<img src="spinningred.gif" /><br />Loading Large Image...', //HTML for loading message. Make sure image paths are correct
    
    	/////NO NEED TO EDIT BEYOND HERE////////////////
    
    	dsetting: {trigger:'mouseover', preload:'yes', fx:'fade', fxduration:500, enabletitle:'yes'}, //default settings
    	buildimage:function($, $anchor, setting){
    		var imghtml='<img src="'+$anchor.attr('href')+'" style="border-width:0" />'
    		if (setting.link)
    			imghtml='<a href="'+setting.link+'">'+imghtml+'</a>'
    		imghtml='<div>'+imghtml+((setting.enabletitle && $anchor.attr('title')!='')? '<br />'+$anchor.attr('title') : '')+'</div>'
    		return $(imghtml)
    	},
    
    	showimage:function($image, setting){
    		$image.stop()[setting.fxfunc](se . . .
    Notice that because of the way the red condition in it is stated, regardless of how that is set 'yes' or 'no' (both strings), it will evaluate as true.

    To fix it, change that line to (addition highlighted):

    Code:
    		imghtml='<div>'+imghtml+((setting.enabletitle !== 'no' && $anchor.attr('title')!='')? '<br />'+$anchor.attr('title') : '')+'</div>'
    Last edited by jscheuer1; 09-27-2010 at 04:55 AM. Reason: spelling
    - John
    ________________________

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

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Thanks, .js file updated with the fix.
    DD Admin

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

    jscheuer1 (09-28-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
  •