mouseenter - jquery .on method don't work -
i work on script show video, when "onmouseover" on div. because of ie use jquery function call mouseenter, nothing happend.
my script:
jquery.fn.playmoviehome = function () { alert("something"); var co = $(this).children("a").children("img").attr("src").split('images/')[1].split('.')[0]; var odkaz = $(this).children("a").attr("href"); $(this).children("a").after("<div id='video' style='position:absolute;width:163px;height:123px;top:5px;'><embed type='application/x-shockwave-flash' src='http://pacogames.com/games/videos/" + co + ".swf' width='163' height='123' wmode='transparent'></embed><a href='" + odkaz + "'><img src='http://pacogames.com/images/163x123.gif' style='position:absolute;left:0px;width:163px;height:123px;top:5px;'></a></div>"); }; jquery.fn.stopmoviehome = function () { $(this).children('#video').remove(); };
and:
$("div#games").on('mouseenter', '.videobox', function () { var element = $(this); $(element).data('timeouthra', settimeout(function () { $(element).playmoviehome(); }, 250)); }); $("div#games").on('mouseleave', '.videobox', function () { var element = $(this); cleartimeout($(element).data('timeouthra')); $(this).stopmoviehome(); });
and html looks this:
<div id="games"> <li id="videobox-id" class="videobox"> <a href="/games/nascar.swf"> <img class="boxgames_img" src="./images/nascar.png" alt="play nascar" style="position: relative; z-index: 1;" /><br />nascar racing </a> </li> </div>
it dont work. knows why? missing?
try this:
$("div#games").on('mouseenter', '.videobox', function () { var element = $(this); element.data('timeouthra', settimeout(function () { element.playmoviehome(); }, 250)); }); $("div#games").on('mouseleave', '.videobox', function () { var element = $(this); cleartimeout(element.data('timeouthra')); element.stopmoviehome(); });
Comments
Post a Comment