2012-02-18 2 views
-4

Pardon для этого, я просто получаю эту ошибку в консоли, но я не вижу ее? Я могу быть слепым в данный момент, кто-нибудь, пожалуйста, поможет мне устранить эту ошибку?отсутствует) после списка аргументов else {- я не вижу его?

говорит: "отсутствует) после списка аргументов еще {"

//run the function for all boxes 
$(".box").each(function() { 

var thisBox = $(this); 
var url = thisBox.href; 
var infoBox = $(".info", thisBox); 
thisBox.data('height', $(this).height()); 

thisBox.click(function() { 

    if (!thisBox.hasClass("opened")) { 
     thisBox.addClass("opened"); 
     $("img", box).fadeOut("slow", function() { 
      infoBox.css({ 
       "visibility": "visible", 
       "height": "auto" 
      }); 

      infoBox.load(url, function() { 
       $('.readMore', thisBox).click(function (e) { 
        e.preventDefault(); 
        var selector = $(this).attr('data-filter-all'); 
        $('#container').isotope({ 
         filter: selector 
        }); 
        $('#container').isotope('reloadItems'); 
        return false; 
       }); 

       $('<a href="#" class="closeBox">Close</a>"').appendTo(infoBox).click(function (e) { 
        e.preventDefault(); 
        $("html, body").animate({ 
         scrollTop: 0 
        }, 500); 
        $('#container').isotope('reLayout'); 
       }); 

       var newHeight = infoBox.outerHeight(true); 
       thisBox.css({ 
        "width": "692", 
        "height": newHeight 
       }); 

       infoBox.animate({ 
        width: 692, 
        height: newHeight 
       }, function() { 
        $('#container').isotope('reLayout', function() { 
         Shadowbox.setup(); 
         thisBox.removeClass("loading"); 
         infoBox.css({ 
          "visibility": "visible" 
         }); 
         var videoSpan = infoBox.find("span.video"); 
         iframe = $('<iframe/>', { 
          'frameborder': 0, 
          'class': 'tide', 
          'width': '692', 
          'height': '389', 
          'src': 'http://player.vimeo.com/video/' + videoSpan.data("vimeoid") + '?autoplay=0&api=1' 
         }); 
         videoSpan.replaceWith(iframe); 
        }); 
       }); 

      }); 

     } 
     else { 
      $(".info").empty(); 
      $("img", thisBox).fadeIn("slow"); 
      thisBox.css("width", "230"); 
      thisBox.height(box.data('height')); 
      thisBox.removeClass("opened"); 
     }; 

     }); 
}); 

}); 
+4

принадлежит на http://www.specsavers.co.uk/ –

+2

Ваш редактор должен быть в состоянии свернуть разделы кода и пары изюминки фигурных скобок. Используйте это. –

+1

@LightnessRacesinOrbit comment - лучший способ решить эту проблему, вы узнаете больше в конце. – xanderer

ответ

1

Вы должны переместить одну '});' дна перед другом:

//run the function for all boxes 
$(".box").each(function() { 

var thisBox = $(this); 
var url = thisBox.href; 
var infoBox = $(".info", thisBox); 
thisBox.data('height', $(this).height()); 

thisBox.click(function() { 

if (!thisBox.hasClass("opened")) { 
    thisBox.addClass("opened"); 
    $("img", box).fadeOut("slow", function() { 
     infoBox.css({ 
      "visibility": "visible", 
      "height": "auto" 
     }); 

     infoBox.load(url, function() { 
      $('.readMore', thisBox).click(function (e) { 
       e.preventDefault(); 
       var selector = $(this).attr('data-filter-all'); 
       $('#container').isotope({ 
        filter: selector 
       }); 
       $('#container').isotope('reloadItems'); 
       return false; 
      }); 

      $('<a href="#" class="closeBox">Close</a>"').appendTo(infoBox).click(function (e) { 
       e.preventDefault(); 
       $("html, body").animate({ 
        scrollTop: 0 
       }, 500); 
       $('#container').isotope('reLayout'); 
      }); 

      var newHeight = infoBox.outerHeight(true); 
      thisBox.css({ 
       "width": "692", 
       "height": newHeight 
      }); 

      infoBox.animate({ 
       width: 692, 
       height: newHeight 
      }, function() { 
       $('#container').isotope('reLayout', function() { 
        Shadowbox.setup(); 
        thisBox.removeClass("loading"); 
        infoBox.css({ 
         "visibility": "visible" 
        }); 
        var videoSpan = infoBox.find("span.video"); 
        iframe = $('<iframe/>', { 
         'frameborder': 0, 
         'class': 'tide', 
         'width': '692', 
         'height': '389', 
         'src': 'http://player.vimeo.com/video/' + videoSpan.data("vimeoid") + '?autoplay=0&api=1' 
        }); 
        videoSpan.replaceWith(iframe); 
       }); 
      }); 

     }); 
    }); 
    } 
    else { 
     $(".info").empty(); 
     $("img", thisBox).fadeIn("slow"); 
     thisBox.css("width", "230"); 
     thisBox.height(box.data('height')); 
     thisBox.removeClass("opened"); 
    }; 
    }); 
}); 
+0

путем копирования этих консолей говорит: «незаконный символ» –

+0

Я предполагаю, что это новая ошибка, скобки должны быть правильными. – Ixx

+0

yep- был кеширован! :) спасибо большое –

1

Вокруг линии 19 здесь:

$("img", box).fadeOut(

Вы не закрываем этот вызов функции. Вам нужно закрыть его по строке 68 с помощью });, как показано ниже.

//run the function for all boxes 
$(".box").each(function() { 

var thisBox = $(this); 
var url = thisBox.href; 
var infoBox = $(".info", thisBox); 
thisBox.data('height', $(this).height()); 

thisBox.click(function() { 

if (!thisBox.hasClass("opened")) { 
    thisBox.addClass("opened"); 
    $("img", box).fadeOut("slow", function() { 
     infoBox.css({ 
      "visibility": "visible", 
      "height": "auto" 
     }); 

     infoBox.load(url, function() { 
      $('.readMore', thisBox).click(function (e) { 
       e.preventDefault(); 
       var selector = $(this).attr('data-filter-all'); 
       $('#container').isotope({ 
        filter: selector 
       }); 
       $('#container').isotope('reloadItems'); 
       return false; 
      }); 

      $('<a href="#" class="closeBox">Close</a>"').appendTo(infoBox).click(function (e) { 
       e.preventDefault(); 
       $("html, body").animate({ 
        scrollTop: 0 
       }, 500); 
       $('#container').isotope('reLayout'); 
      }); 

      var newHeight = infoBox.outerHeight(true); 
      thisBox.css({ 
       "width": "692", 
       "height": newHeight 
      }); 

      infoBox.animate({ 
       width: 692, 
       height: newHeight 
      }, function() { 
       $('#container').isotope('reLayout', function() { 
        Shadowbox.setup(); 
        thisBox.removeClass("loading"); 
        infoBox.css({ 
         "visibility": "visible" 
        }); 
        var videoSpan = infoBox.find("span.video"); 
        iframe = $('<iframe/>', { 
         'frameborder': 0, 
         'class': 'tide', 
         'width': '692', 
         'height': '389', 
         'src': 'http://player.vimeo.com/video/' + videoSpan.data("vimeoid") + '?autoplay=0&api=1' 
        }); 
        videoSpan.replaceWith(iframe); 
       }); 
      }); 

     }); 

    }); 
} 
    else { 
     $(".info").empty(); 
     $("img", thisBox).fadeIn("slow"); 
     thisBox.css("width", "230"); 
     thisBox.height(box.data('height')); 
     thisBox.removeClass("opened"); 
    }; 

    }); 
}); 

}); 
+0

консоль говорит для последней строки: незаконный символ "});" –

+0

удалено последним}); Сейчас все в порядке. –

Смежные вопросы