wordpress - Javascript Inline and External Script difference -


i need help, porting internal scripts on website single js file speed website according google , yahoo page speed recommendations.

i have following script in page footer.php (i using wordpress)

<script> (function ($) { jquery(function () {     var $container = $('#container');     $container.imagesloaded(function () {         $container.masonry({             itemselector: '.box',             columnwidth: 100         });     });     $container.infinitescroll({         navselector: '.post-nav',         nextselector: '.previous a',         itemselector: '.box',         loading: {             finishedmsg: 'no more pages load.',             img: '/wp-content/themes/images/ajax-loader.gif'         }     },      function (newelements) {         var $newelems = $(newelements).css({             opacity: 0         });         $newelems.imagesloaded(function () {             $newelems.animate({                 opacity: 1             });             $container.masonry('appended',             $newelems, true);         });     }); }); })(jquery)  </script> 

if script in footer works 100%, when add single js stops working...

any ideas on why is, , how should load script same way external js stylesheet executes when inline.

remove starting <script>and ending tag </script> while using in external js file. make sure including jquery before js file.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -