문제

I am trying to load some jquery on window load however I recieve the error of 'jQuery is not defined'.

Here is my jquery.

jquery(function($) { //jQuery passed in as first param, so you can use $ inside
jquery(window).load(function ($) {
    $('#newsPost').masonry({
      columnWidth: '.col-lg-6',
      itemSelector: '.item'
    });      
})
});

I had it working fine with document ready however window load is coming up not defined.


Here is an update showing the final working version:

jQuery(function($) { 
$(window).load(function () {
$('#newsPost').masonry({
  columnWidth: '.col-lg-6',
  itemSelector: '.item'
});      
})
});
도움이 되었습니까?

해결책

Replace jquery with jQuery or $.

Or

Are you sure you have loaded jquery script file ?

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top