Results 1 to 6 of 6

Thread: Ultimate fadeinslideshow - Make Text Clickable

  1. #1
    Join Date
    Sep 2010
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Ultimate fadeinslideshow - Make Text Clickable

    1) Script Title: Ultimate fadeinslideshow

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

    3) Describe problem:

    I have a slightly modified version of the script where the Text is quite large and perminantly positioned in front of the corresponding image(s)
    As can be seen here: onwireless.com.au
    The problem is that the the Text is not click-able. Since the Text Block covers the image, when a user mouse clicks the text it wont link like the image does.
    I would be keen to know the mod to make the text clickable. Thanks in advance for any help.

  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

    You don't really need to edit the script. You can simply add the link into the description field of the imagearray. for example:

    Code:
    var $ = jQuery, mygallery2=new fadeSlideShow({
    	wrapperid: "fadeshow2", //ID of blank DIV on page to house Slideshow
    	dimensions: [776, 180], //width/height of gallery in pixels. Should reflect dimensions of largest image
    	imagearray: [
    
    		["images/fade_in_banner/telstra-tower.jpg", "/service-provider.html", "_new", "&nbsp; Want to fix your 3G Wireless Broadband Connection?<br>&nbsp; "],
    		["images/fade_in_ban . . .
    Let's zoom in on the highlighted description:

    Code:
    "&nbsp; Want to fix your 3G Wireless Broadband Connection?<br>&nbsp; "
    That can become:

    Code:
    "<a href='/service-provider.html' target='_new'>&nbsp; Want to fix your 3G Wireless Broadband Connection?<br>&nbsp; </a>"
    Notice that the attributes (href and target in this case) are single quoted, not double quoted. This is required due to the requirements of nested quotes in javascript either being escaped or of a different type than the quotes that delimit the string.

    These links can be styled via css. This will be their selector:

    Code:
    .descpanelfg a
    So you could style them in a stylesheet like:

    Code:
    .descpanelfg a {
    	text-decoration: none;
    }
    The browser cache may need to be cleared and/or the page refreshed to see changes.
    - John
    ________________________

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

  3. #3
    Join Date
    Sep 2010
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi john,
    Thank you for the fine reply.
    I did not try that approach as I was hoping to not have to define the link url twice. This would cause confusion when making changes etc.
    If this is the only way to do it then thats what Ill do, but since there has been a need to mod some of the js code already, it would be nice to make a mod that only requires the url to be defined once.
    Thanks again.
    Cheers

  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

    People get mod happy with scripts sometimes. I know sometimes it's the only way, or can seem like the only way though. What mods have you already made? Often css style can be used, for instance in changing the background, colors, fonts, positioning, etc. There are also callbacks for the onslide and oninit functions that can alter things without actually editing the script. It's a good idea when possible not to edit the script. That makes future support easier.

    At the same time, I do see what you're saying about having to edit twice. So instead of what I suggested above, try adding this to the on page call:

    Code:
     . . . er/SIM-on-tower.jpg", "/3g-4g-antenna-arial.html", "_new", "&nbsp; Find an Antenna Kit to suit your modem.  "],
    		["images/fade_in_banner/money_back_guarantee180x180.gif", "/3g-4g-antenna-arial.html", "_new", "&nbsp; 100% Satisfaction Guaranteed!"],
    		["images/fade_in_banner/telstra-tower.jpg", "/contact-us.html", "_new", "&nbsp; Contact us for more information."],
    		["images/fade_in_banner/telstra-tower.jpg", "", "_new", ""]         //<--no trailing comma after very last image element!
    	],
    	displaymode: {type:'auto', pause:4000, cycles:0, wraparound:true},
    	persist: false, //remember last viewed slide and recall within same session?
    	fadeduration: 500, //transition duration (milliseconds)
    	descreveal: "always",
    	onslide: function(curimage, index){
    		var link = jQuery(curimage).find('img').eq(index).parent('a'), html, color, $desc;
    		if(link.size()){
    			$desc = this.setting.$descinner;
    			html = $desc.html();
    			color = $desc.css('color');
    			link = link.clone(false).html(html).css({textDecoration: 'none', display: 'block', height: '100%', color: color});
    			$desc.empty().append(link.find('img.close').remove().end());
    		}
    	},
    	togglerid: "fadeshow2toggler"
    })
    
    </script>
    That will (if and only if there's a link on the image) create that same link on the captions/descriptions each time the image changes.

    The browser cache may need to be cleared and/or the page refreshed to see changes.

    Oh, and if you add this rule to the stylesheet:

    Code:
    #fadeshow2 {
    	width: 776px;
    	height: 180px;
    }
    The page won't jump around as much in some browsers while it's loading.
    Last edited by jscheuer1; 10-29-2012 at 07:18 AM. Reason: improve for IE, add css suggestion
    - John
    ________________________

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

  5. #5
    Join Date
    Sep 2010
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Great advice, I certainly would prefer to do things using Css. I cant recall all the mods i did to the js script, I think they related to changing the background from black to white and attempting to make the background transparent. And that different instances use different font colors and size and position etc.
    Ill get to add the code in the next week or so.
    Thanks again for your help.

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

    Yes css is very powerful. With this script though you often need to use overriding css with the !important keyword. For instance, for a white background:

    Code:
    #fadeshow2, #fadeshow2 .gallerylayer {
    	background-color: white !important;
    }
    Transparent can be done the same way, except if the images themselves contain transparent sections and these don't line up or if the images are of varying sizes, there will be bleed through. That can be dealt with using javascript and code in the onslide function without editing the script. If it's just a transparent background for the descriptions though:

    Code:
    #fadeshow2 .descpanelbg {
    	background-color: transparent !important;
    }
    The descriptions may also be positioned in a similar way:

    Code:
    #fadeshow2 .fadeslidedescdiv {
    	top: 45% !important;
    }
    There's a lot that can be done, and not all of it requires the !important keyword. But for this sort of thing as regards this script it usually doesn't hurt to use it, even when not required.
    - John
    ________________________

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

Similar Threads

  1. Simple Tree Menu: non-clickable text
    By jol-dd in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 11-13-2010, 01:12 AM
  2. RSS displaybox: make the links in the text clickable
    By flapane in forum Dynamic Drive scripts help
    Replies: 4
    Last Post: 10-25-2010, 07:30 AM
  3. make the (other) mouseover display image id a clickable link
    By artisartsy in forum Looking for such a script or service
    Replies: 3
    Last Post: 08-22-2010, 04:45 PM
  4. Replies: 1
    Last Post: 05-02-2009, 12:24 PM
  5. Can I make an entire <td> field 'clickable'?
    By DowntownEER in forum JavaScript
    Replies: 6
    Last Post: 07-23-2006, 04:04 PM

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
  •