【问题标题】:jQuery Slider and IE9 - Append and possible problemsjQuery Slider 和 IE9 - 追加和可能的问题
【发布时间】:2012-11-04 17:09:04
【问题描述】:

我的 IE 和我的 jQuery 遇到了问题。

我在这个 WordPress 安装中使用了一个滑块插件,并且我正在加载以下代码来创建 2 个自定义的上一个/下一个按钮:

jQuery(document).ready(function($) {

    var sliderInstance = $("#touchcarousel-1, #touchcarousel-2, #touchcarousel-3, #touchcarousel-4, #touchcarousel-5, #touchcarousel-6").data("touchCarousel");

    $("body").append('<a href="#" class="arrowleft"><img src="/wp-content/themes/revisor/images/left.png" /></a><a href="#" class="arrowright"><img src="/wp-content/themes/revisor/images/right.png" /></a>');

    var arrleft = $(".arrowleft")

        arrright = $(".arrowright");

    var wrapoffset = $("#wrap").offset();

    console.log(wrapoffset.left);

    arrleft.css("left" , wrapoffset.left-100);

    arrright.css("right" , wrapoffset.left-100);

    arrleft.click(function(e)

    {
        e.preventDefault();
        sliderInstance.prev();

    });

    arrright.click(function(e)

    {
        e.preventDefault();
        sliderInstance.next();

    });

    $(window).resize(function() {

        var wrapoffset = $("#wrap").offset();

        arrleft.css("left" , wrapoffset.left-100);

        arrright.css("right" , wrapoffset.left-100);

    });

});

在 FF 和 Chrome 中,这可以正常工作,但在 IE 中不行(在 IE9 中测试)。

我很难过,因为按钮上的命令都不起作用 - CSS 和事件都不起作用。

在此处查看页面:http://revisor-faellesskabet.dk/skat/

【问题讨论】:

    标签: jquery wordpress internet-explorer slider


    【解决方案1】:

    删除console.log--它将在IE中中断,因为控制台仅在开发人员工具打开时可用

    【讨论】:

      猜你喜欢
      • 2012-05-24
      • 1970-01-01
      • 1970-01-01
      • 2013-10-21
      • 1970-01-01
      • 2014-01-13
      • 1970-01-01
      • 1970-01-01
      • 2012-08-06
      相关资源
      最近更新 更多