Internet Explorer 8上的jQuery + Fancybox触发器错误 [英] jQuery + Fancybox trigger error on Internet Explorer 8

查看:130
本文介绍了Internet Explorer 8上的jQuery + Fancybox触发器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的页面上有这个jQuery代码在Chrome中工作正常,但是我在触发器('click')行中获得了Internet Explorer 8的错误

I have this jQuery code on my page that works fine in Chrome, but I get and error on Internet Explorer 8 in the trigger('click') line

$('#btnd16').click(function(e){
    var iiid = $('#midet').val();
    $('#d16_midethistorial_id').val(iiid);

    //sumamos por ajax
    var $mivalor = $('#d16_midethistorial_id').val() 
    var $url = $('input#miruta').val(); 

    $.post($url, { midethistorial_id: $mivalor }, 
        function(data) { 
                $("#nirefancy").fancybox({
                'width'         : '90%',
                'height'    : '90%',
                'transitionIn'  : 'elastic',
                'transitionOut' : 'elastic',
                'type'      :'inline',
                'autoDimensions': false,
                'autoScale' : false,
                        'scrolling' : 'no',
                'titleShow' : true,
            }).trigger('click');
    });

    return false
});

这是我的fancybox的html:

This is my html for fancybox:

<a href="{{ path('detformacion_play',{'id': detentrenamiento.detformacion.id }) }}"  id="nirefancy" style="display: none;">.</a>

我点击了一个butten,我在数据库中通过ajax插入了一些数据,之后我想要打开一个花哨的盒子。就像我说的,它适用于Chrome但不适用于IE8

I clicked in a butten and I insert some data throught ajax in the database, after that I want to open a fancybox. Like I said, it works on Chrome but not in IE8

任何帮助或线索?
提前谢谢

any help or clue? thanks in advance

推荐答案

在我的脑海中,有两个可能性:

Off the top of my head, two possibilites:

1)'titleShow':true,< - 对象IE结尾的额外逗号解释为撒旦

1) 'titleShow' : true, <-- extra comma at the end of object IE interprets as Satan

2)将您的事件处理程序包含在文档就绪块中:

2) Enclose your event handler in a document ready block:

$(document).ready(function () {
    $('#btnd16').click(function (e) {
    ...
});

这篇关于Internet Explorer 8上的jQuery + Fancybox触发器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆