I am having a Fancybox load as soon as the page loads. Works fine in FF but it does not work in IE and I am unsure as why. I get no errors in IE when the page loads. It just doesn't work.
Script for Fancybox
<script type="text/javascript" >
var $j = jQuery.noConflict();
$j(document).ready(function(){
Engine.Initialize(); /开发者_StackOverflow中文版/Not Fancybox - Loads different Script
$j("#start").fancybox({
'padding' : 0
});
});
</script>
HTML for Fancybox
<div class="hide">
<a href="#welcome" id="start"></a>
<img src="/Images/skin/spacer1x1.png" onload="$j('#start').trigger('click');" />
<img src="/Images/start/start.png" alt="PLEASE VIEW PAGE WITH IMAGES ON" border="0" usemap="#welcomeMap" id="welcome" style="width:700px; height:600px;" />
<map name="welcomeMap" id="welcomeMap">
<area shape="rect" coords="31,505,347,538" href="/examples/month-1/" />
<area shape="rect" coords="512,506,660,542" href="javascript:$j.fancybox.close();" alt="Close" />
</map>
</div>
Not sure why it does not work in IE. Is it the onload to "trigger" the click to launch the Fancybox?
Thanks for any help!
I think in IE it is trying to redirect to href on click of anchor. Can you try this.
$j("#start").click(function(e){
e.preventDefault();
$j(this.href).fancybox({
'padding' : 0
});
});
In my project I'm using the following code:
<script>
$(document).ready(function () {
$("#status-link").fancybox(
{ 'modal': true }
);
$("#status-link").trigger('click');
});
</script>
<a id="status-link" href="test.aspx" style="visibility: hidden"</a>
Works for me in IE7/8. You can try something like this.
精彩评论