javascript - jQuery Loaded in noConflict Mode, Can't Access $ Even if Passed as Function Parameter -
i have jquery loaded jquery.noconflict() @ top (in wordpress).
then have following custom function:
var equalizeheights = function(){ $('.header').height(500); } which call on .ready() way:
jquery(function($){ equalizeheights(); }); the $ in function parameter supposed make shorthand version of jquery variable available throughout block, line try set height in equalizeheights() function returns error in console.
uncaugth typeerror: property '$' of object [object object] not function
i sure have library loaded, , not issue, since if console.log $ variable before calling equalizeheights() returns valid jquery object. issue $ not inherited child function reason.
making $ global , assigning $ = jquery not option.
any ideas?
you have define equalizeheights in scope of ready callback function
jquery(function($){ equalizeheights($); var equalizeheights = function($){ $('.header').height(500); } }); if need global,
var equalizeheights; jquery(function($){ equalizeheights = function($){ $('.header').height(500); } equalizeheights($); });
Comments
Post a Comment