JQuery .each () и IE все версии проблемы - PullRequest
0 голосов
/ 22 июня 2010

Я использую этот код, и он работает на всех браузерах без сбоев, но с IE все версии не работают, может кто-нибудь помочь мне с этим

$('a.download').each(function() {
    $(this).colorbox({href:$(this).attr('href') + ' div#download_popup',onComplete: function(){
    $('div.sociable').hide();
    $('a#share_button').click( function(){
        $('div.sociable').slideToggle().show();

    });

}})});

Ответы [ 3 ]

1 голос
/ 22 июня 2010

Очистка кода (во всяком случае, лучше), похоже, ему не хватает точки с запятой

$('a.download')
    .each(function() {
        $(this).colorbox({
            href: $(this).attr('href') + ' div#download_popup',
            onComplete: function() {
                $('div.sociable').hide();
                $('a#share_button').click(function() {
                    $('div.sociable').slideToggle().show();
                });
            }
        }); // RIGHT HERE
    });
1 голос
/ 22 июня 2010
$('a.download').each(function()
{
    $(this).colorbox(
    {
        href: $(this).attr("href") + ' div#download_popup',
        onComplete: function()
        {
            $('div.sociable').hide();
            $('a#share_button').click(function()
            {
                $('div.sociable').slideToggle().show();
            });
        }
    });
});

Когда вы выравниваете блоки кода по вертикали, легче увидеть отсутствующие фигурные скобки, скобки или точки с запятой.

0 голосов
/ 22 июня 2010
$('a.download').each(function() {
    $(this).colorbox({
        href:$(this).attr('href') + ' div#download_popup',
        onComplete: function()  {
            $('div.sociable').hide();
            $('a#share_button').click( function() {
                $('div.sociable').slideToggle().show();
            });
        }
    }) // - missing semicolon goes here
});

Вам не хватает точки с запятой.

...