Jquery 工具覆盖在 IE7 中不起作用
我正在使用 Jquery 工具覆盖,它允许我加载外部页面 - http://flowplayer。 org/tools/demos/overlay/external.html
我在 IE7 中遇到了一个问题(在 IE8/chrome 等上工作正常)
当我单击调用叠加层时,我会被发送到实际的外部文件而不是留在页面并具有包含外部文件的覆盖层。
这是 jquery:
<script>
$(function() {
// if the function argument is given to overlay,
// it is assumed to be the onBeforeLoad event listener
$("a[rel]").overlay({
mask: {
color: '#000',
loadSpeed: 200,
opacity: 0.8,
},
onBeforeLoad: function() {
// grab wrapper element inside content
var wrap = this.getOverlay().find(".contentWrap");
// load the page specified in the trigger
wrap.load(this.getTrigger().attr("href"));
}
});
});
$('.close').live('click', function() {
$("#overlay").fadeOut('slow', function() {
});
$("#exposeMask").fadeOut('slow', function() {
});
});
</script>
这是 HTML:
<!-- overlayed element -->
<div id="overlay" class="apple_overlay">
<!-- the external content is loaded inside this tag -->
<div class="contentWrap"></div>
</div>
<a href="Overlay_Login.php" rel="#overlay" class='button button_small_grey'>Login</a>
如果您还没有猜到我对 jquery 的了解不是很好。因此,如果有人能够阐明这个问题,我们将不胜感激。
I'm using Jquery tools overlay that allows me to load external pages - http://flowplayer.org/tools/demos/overlay/external.html
I've run into an issue in IE7 (works fine on IE8/chrome etc.)
When I click the that calls the overlay I'm sent to the actual external file rather than stay on the page and have an overlay that includes the external file.
Here's the jquery:
<script>
$(function() {
// if the function argument is given to overlay,
// it is assumed to be the onBeforeLoad event listener
$("a[rel]").overlay({
mask: {
color: '#000',
loadSpeed: 200,
opacity: 0.8,
},
onBeforeLoad: function() {
// grab wrapper element inside content
var wrap = this.getOverlay().find(".contentWrap");
// load the page specified in the trigger
wrap.load(this.getTrigger().attr("href"));
}
});
});
$('.close').live('click', function() {
$("#overlay").fadeOut('slow', function() {
});
$("#exposeMask").fadeOut('slow', function() {
});
});
</script>
And here's the HTML:
<!-- overlayed element -->
<div id="overlay" class="apple_overlay">
<!-- the external content is loaded inside this tag -->
<div class="contentWrap"></div>
</div>
<a href="Overlay_Login.php" rel="#overlay" class='button button_small_grey'>Login</a>
If you hadn't already guessed my knowledge with jquery isn't great. So if anyone could shed some light on the problem it'd be much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
恕我直言,从经验来看,我会远离 jQuery 工具,特别是如果您对 jQuery 没有很好的应用知识。由于需要大量的标记和奇怪的方法,它与您可能遇到的任何其他 jQuery 插件不同。如果您确实想了解有关如何正确使用 jQuery 的更多信息,请坚持使用采用更可靠、普遍接受和标准方法的插件。
jQuery Tools 已经一年多没有更新了(自 jQuery 1.4.2 以来),并且在 IE9 和 IE9 上存在很多问题。 Flowplayer 论坛中报道的 jQuery 1.6。开发商 Tero 在过去的一年里对此表现得相当不稳定。他与社区互动的时间几乎为零,并且用他自己的话说,最近他谈到了他对其他项目和家庭的干扰。他似乎也无法让足够多的其他人参与进来,以使这个项目成为一个社区项目或更能自我维持。
尽管据说新版本即将发布(从 2011 年 6 月开始?),但它不会向后兼容您的任何旧代码,因此无论如何您都必须重写所有内容。当 Tero 决定在更新的 jQuery 和浏览器发布时再次长时间中断时,谁敢说您不会在一年内再次重写此代码。
jQuery 工具替代品?
至于您的特定问题,我看到一个“结尾逗号” 在下面的
opacity: 0.8
行之后:某些版本的 Internet Explorer 会因为逗号后面没有任何内容而卡住。
删除它并查看是否有帮助:
IMHO, and speaking from experience, I'd stay away from jQuery Tools especially if you don't have a good working knowledge of jQuery. With the large amount of required markup and strange methodology, it's not like any other jQuery plugin you'll likely encounter. If you really want to learn more about how to properly use jQuery, stick with plugins that employ more reliable, commonly accepted, and standard methods.
jQuery Tools has not been updated in over a year (since jQuery 1.4.2) and has lots of problems with IE9 & jQuery 1.6 as reported in the Flowplayer forums. The developer, Tero, has been quite flaky about it over the past year. He has spent almost zero time interacting with his community, and by his own words, has talked recently about his distractions with other projects and family. He also cannot seem to get enough other people involved in order to make this a community project or more self-sustaining.
Although a new release is supposedly imminent (since June 2011?), it won't be backward compatible with any of your old code so you'll have to rewrite everything anyway. And who's to say you won't be rewriting this code again in a year when Tero decides to take another long hiatus while newer jQuery and browsers are being released.
jQuery Tools Alternatives?
As far as your particular problem, I see a "trailing comma of death" after the
opacity: 0.8
line below:Certain versions of Internet Explorer will choke on commas when nothing comes after them.
Remove it and see if that helps: