问题
I'm using Mal's Cart and I want the View Cart link to show the cart contents inside a Fancybox window. This works in Windows Firefox 18, Chrome 24, Opera 12, and Safari but in IE8 the fancybox will pop up blank, refreshing the box will show the content. Turn Compatibility View on and it works fine.
http://www.riptest.info Using IE8, click the "Buy A License" button on the first post and it works, then click the "View Cart" button in left sidebar and it pops up a blank page, refresh the white page and it shows the content.
Code for Buy A License button:
<a href="http://www.riptest.info/fancyboxtest.html" class="iframe rollover"><span class="displace">Buy A Beat</span></a>
Code for sidebar.php View Cart button:
<a href="http://ww11.aitsafe.com/cf/review.cfm?userid=D886658" class="iframe"><img src="http://www.rockitpro.com/misc/viewcart.gif" width="130px" height="20px" alt="View Your Cart" border="0px"></a>
footer.php code (before </body>
):
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript" src="http://www.riptest.info/wp-content/themes/acosmin-v3/fancybox/source/jquery.fancybox.pack.js?v=2.1.4"></script>
<script type="text/javascript">
$(document).ready(function() {
$(".iframe").fancybox({
'fitToView': false,
'autoSize': false,
'scrolling': 'no',
'maxWidth': 820,
'maxHeight': 600,
'width': 800,
'height': 600,
'type':'iframe'
});
});
</script>
I understand it's probably the cart link and my fancybox code isn't set up for that type of link? This is past my know-how so I'm looking for some help. I have 2 available options for the view cart button http://www.mals-e.com/tpv.php?tp=2 but getting Fancybox to work with a form seems a lot more complex than it needs to be, the hyperlink SHOULD work in IE8 since it does in all other browsers right?
回答1:
I do not know why, but in this case, disabling preloading fixes your IE issue.
$(".fancybox").fancybox({
iframe : {
preload: false
}
});
See - http://jsfiddle.net/hwvqf/1/
来源:https://stackoverflow.com/questions/14545769/view-contents-of-cart-inside-fancybox-blank-page-only-in-ie8