Reputation: 31
I work on my script to show some video, when you are "onmouseover" on my div. Because of IE I use jquery function which call mouseenter, but 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 like 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. does anybody knows why? what am i missing?
Upvotes: 0
Views: 129
Reputation: 73966
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();
});
Upvotes: 1