Farfpoovere
New Member
I want an event to trigger when I hover my mouse over an object.When I try to use jquery's mouseuner or mouseover the event triggers once when the page loads, and does not trigger when I hover over the image or imageboxMy code is below. I really don't understand what's happening.Thank you.\[code\]<!DOCTYPE html><html> <head> <script src="http://stackoverflow.com/questions/15581017/jquery-1.9.1.min.js"> </script> <script> var img = ''; var offset_const = 0.03; var timer = ''; $(document).ready(function(){ function init(obj, image, psize){ var height = obj.height(); //obj.height(1000); var imageId = 'vtourImg'; img = $('<img id="'+ imageId +'">'); img.attr('src', image); img.attr('height', height); obj.append(img); //$(obj).mouseenter(function(e){setInterval(function(e){scroller(e);}, 1000);}); } function scroller(e){ //setTimeout(scroller(e), 10000); var x = e.pageX - this.offsetLeft; var y = e.pageY - this.offsetTop; var midX = $(this).width() / 2; var current_offsetX = img.offset().left; var offsetX_add = offset_const * -1 * (x - midX); var offsetX = 0; offsetX = current_offsetX + offsetX_add; img.offset({left: offsetX }); } init($('#vtour'), 'virtualtour4.jpg', 0.00); img.mouseenter(alert('test')); }); </script> </head> <body> <div id="vtour" style="width:500px;height:500px;border:3px black solid;overflow:hidden;"></div> </body></html>\[/code\]