PDA

View Full Version : ddimgtooltip - roll over positioning



Lee540
09-01-2011, 03:21 PM
1) Script Title: ddimgtooltip

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

3) Describe problem: Unable to get rollover pop-up image to appear in the same place on the page, regardless of where the text is located on that page.

I have this so far, and its works to get the image always in the same place relating to the x-axis.. when I try to setup the y-axis the image drops to the bottom of the page and it makes no difference which value I enter.

This is what I have so far, this is correct for x-axis, but y-axis still follows the mouse.


positiontooltip:function($, $tooltip, e){
var x=e.pageX+this.tooltipoffsets[0], y=e.pageY+this.tooltipoffsets[1]
var tipw=$tooltip.outerWidth(), tiph=$tooltip.outerHeight(),
x=(x+tipw>$(document).scrollLeft()+$(window).width())? x-tipw-(ddimgtooltip.tooltipoffsets[0]*2) : $(document).scrollLeft()+$(window).width()-tipw-10
y=(y+tiph>$(document).scrollTop()+$(window).height())? $(document).scrollTop()+$(window).height()-tiph-10 : y
$tooltip.css({left:x, top:y})

What do I need to change this to, in order to lock its position in the y-axis?


y=(y+tiph>$(document).scrollTop()+$(window).height())? $(document).scrollTop()+$(window).height()-tiph-10 : y

Thanks in advance

Lee

ddadmin
09-02-2011, 04:40 PM
There are a couple of ways to do this depending on where exactly you wish the tooltip to be shown relative to the anchor. But one quick way to anchor the tooltip once the mouse rolls over the anchor link is to comment out the below line inside the .js file:


$target.mousemove(function(e){
//var $tooltip=$("#"+this._tipid)
//ddimgtooltip.positiontooltip($, $tooltip, e)
})

Lee540
10-10-2011, 08:41 AM
Thanks for your reply.

This has helped, however it wasn't entirely what I meant sorry.

How do I get all tool tips to appear in the same location on a page regardless of where the link is positioned?

Thanks

Lee

Lee540
10-17-2011, 08:50 AM
If this is possible?

Lee540
10-27-2011, 03:34 PM
Admin? :):confused: