ikerib
ikerib

Reputation: 801

jQuery + Fancybox trigger error on 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
});

This is my html for fancybox:

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

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

Upvotes: 3

Views: 1209

Answers (1)

karim79
karim79

Reputation: 342635

Off the top of my head, two possibilites:

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

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

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

Upvotes: 5

Related Questions