Results 1 to 3 of 3

Thread: How to alter Image w/ description tooltip v2.0

  1. #1
    Join Date
    Jan 2010
    Posts
    51
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default How to alter Image w/ description tooltip v2.0

    Script: Image w/ description tooltip v2.0

    http://dynamicdrive.com/dynamicindex4/imagetooltip.htm

    I was wondering how I would go about changing the scroll over in the above code so that the text is beside the image and not under it.

  2. #2
    Join Date
    Jan 2010
    Posts
    51
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Is there no way for this to be done?

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    From the .js file:
    Code:
    	createtip:function($, tipid, tipinfo){
    		if ($('#'+tipid).length==0){ //if this tooltip doesn't exist yet
    			return $('<div id="' + tipid + '" class="ddimgtooltip" />').html(
    				'<div style="text-align:center"><img src="' + tipinfo[0] + '" /></div>'
    				+ ((tipinfo[1])? '<div style="text-align:left; margin-top:5px">'+tipinfo[1]+'</div>' : '')
    				)
    			.css(tipinfo[2] || {})
    			.appendTo(document.body)
    		}
    		return null
    	},
    You would modify that to create a different kind of HTML, probably with some CSS.

    Here's one way to start:
    Code:
    	createtip:function($, tipid, tipinfo){
    		if ($('#'+tipid).length==0){ //if this tooltip doesn't exist yet
    			return $('<div id="' + tipid + '" class="ddimgtooltip" />').html(
    				'<div class="tipimg"><img src="' + tipinfo[0] + '" /></div>'
    				+ ((tipinfo[1])? '<div class="tiptext">'+tipinfo[1]+'</div>' : '')
    				)
    			.css(tipinfo[2] || {})
    			.appendTo(document.body)
    		}
    		return null
    	},
    Then in your CSS, give the styles you'd like to the classes tipimg and tiptext.
    For example, use float:left; for both.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

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
  •