View Single Post
Old 11-30-2012, 09:18 PM   PM User | #2
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
You probably need to add the text-offset to the mousemove event as indicated here:

Code:
	$('#product_holder a img').mousemove(function(e){
		$('#largeImage')
			.css('top', e.pageY + offsetY)
			.css('left', e.pageX + offsetX)
		$('#product_text')
			.css('top', e.pageY + offsetY) << + offsetTextY
			.css('left', e.pageX + offsetX)
	});
Otherwise, as soon as the mouse moves a little bit it will ignore the text-offset.

BTW This is probably not the best way to do this - dynamically creating the elements. Preferable would be to have the image and paragraph contained within a hidden div, and use events to change the image src, the p-text, and then show (or fade, etc.) the div.
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS
AndrewGSW is offline   Reply With Quote