Closed jessor closed 8 years ago
Well, you can try
jQuery(document).ready(function(){
});
instead of $(document).ready(function() { });
then you can use $
inside your function
ad. Make sure you hooked the new version of jQuery, I had problems with wordpress's default one.
The problem seems to be the (not needed) $(document).ready(function() { ... });
inside pushpin.js
.
I'm having the issue with just:
(function($) {
'use strict';
$('.side-menu-wrapper').pushpin({
top: $('.side-menu-wrapper').offset().top
});
//[other js init...]
})(jQuery);
in my main.js
file.
And it works well when I remove the ready()
in pushpin.js
.
As far as I'm concerned, I don't understand why the whole function is wrapped in a ready
event, especially when wrapped in a (function ($) { }( jQuery ))
. It won't work if this ready
event is already fired when pushpin.js
/materialize.js
is loaded. Only the init part of the script should be wrapped in a ready
or load
event.
Yes this was definitely a bug on our part, not sure how that happened.
Fixed in bc257335f5259966125444e78e624b7b71a4c78b
Thanks for pointing this out
I'm initializing Pushpin in a WordPress theme like this:
Removing the wrapping
$(document).ready(function() {
});
in materialize.js fixes this.