Jquery 工具覆盖在 IE7 中不起作用

发布于 2024-12-05 11:44:44 字数 1473 浏览 1 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一抹淡然 2024-12-12 11:44:44

恕我直言,从经验来看,我会远离 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 行之后:

$("a[rel]").overlay({    
        mask: {
          color: '#000',
          loadSpeed: 200,
          opacity: 0.8,    
        },
....

某些版本的 Internet Explorer 会因为逗号后面没有任何内容而卡住。

删除它并查看是否有帮助:

$("a[rel]").overlay({    
        mask: {
          color: '#000',
          loadSpeed: 200,
          opacity: 0.8    
        },
....

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:

$("a[rel]").overlay({    
        mask: {
          color: '#000',
          loadSpeed: 200,
          opacity: 0.8,    
        },
....

Certain versions of Internet Explorer will choke on commas when nothing comes after them.

Remove it and see if that helps:

$("a[rel]").overlay({    
        mask: {
          color: '#000',
          loadSpeed: 200,
          opacity: 0.8    
        },
....
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文