2012-02-18 117 views
-4

原谅这个,我只是在控制台中得到这个错误,但我看不到它?此刻我可能会失明,任何人都可以帮我解决这个错误?失踪)参数列表后其他{ - 我看不到它?

说: “以后别的参数列表丢失){”

//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/ – 2012-02-18 16:00:30

+2

您的编辑器应该能够折叠代码段并高亮显示支撑对。使用它。 – 2012-02-18 16:01:12

+1

@LightnessRacesinOrbit评论是解决此问题的更好方法,最终你会学到更多。 – xanderer 2012-02-18 16:04:32

回答

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

通过复制这个控制台说:“非法字符” – 2012-02-18 16:10:21

+0

我想这是一个新的错误,括号应该是正确的。 – Ixx 2012-02-18 16:15:19

+0

yep-被缓存! :)非常感谢 – 2012-02-18 16:25:34

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

控制台说最后一行:非法字符“});” – 2012-02-18 16:11:15

+0

最后删除}); - 现在好了。 – 2012-02-18 16:16:39

相关问题