나는 undefined is not a function
오류의 의미를 알고 있지만 왜 여기에 나타나는지 알 수 없습니다.벽돌 : 정의되지 않은 함수가 아닙니다.
방금 마지막 Masonry 버전을 다운로드하고 문서를 따라 가려고했습니다. (http://desandro.github.io/masonry/docs/methods.html)
레이아웃이 정상적으로 작동하지만 전혀 masonry()
기능을 사용할 수없는 것 같습니다. 내 masonry()
호출에 항상 undefined is not a function
오류가 발생합니다.
레이아웃이 작동하고 있기 때문에 벽돌 스크립트가 정상적으로 작동한다고 가정하고 있습니다. 이 없으면 masonry(...)
을 사용할 수없는 이유는 무엇입니까?
부분 HTML 코드 : 따라서 당신은 jQuery를하기 전에 벽돌을로드
<a class="navbar-brand" id ="test-masonry" href="#">...</a>
<div id="masonry-container" class="js-masonry" data-masonry-options='{ "columnWidth": 330, "itemSelector": ".item" }'>
<div class="item">
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#createNewBlock">Create a new block</button>
</div>
</div>
<!-- Freshly downloaded from the official Masonry website -->
<script src="js/masonry.pkgd.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.18/angular.min.js"></script>
<script src="js/app.js"></script>
<script src="js/controllers/appCtrl.js"></script>
<!-- Copied from the example in the docs -->
<script>
$(function(){
var $container = $('#masonry-container');
$('#test-masonry').click(function(){
var $boxes = $('<div>Test !</div>');
$container.prepend($boxes).masonry('reload');
});
});
</script>
고마워, 그게 문제였습니다. 하지만 "jQuery를 두 번로드하는"방법은 Angular와 jQLite와 관련이 있을지 모르겠습니다. – Sugar
아마도 CMS를 사용하고 있습니까? –
Nop. Masonry, JQuery, AngularJS 및 Bootstrap. 그게 전부 야. 신경 쓰지 마, 지금 일하고있어. – Sugar