HeadJS and jQuery Usage -
trying use http://headjs.com while haven't still because can't understand limited documentation , samples. if can give examples of headjs jquery great.
currently, have:
<!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <title>title</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> </head> <body> ..... ..... <script src="js/jquery.plugins.1.js"></script> <script src="js/jquery.plugins.2.js"></script> <!-- below inline , cannot separate js file because of cms , templating limitation //--> <script> jquery.noconflict(); jquery(document).ready(function($) { $('.class').someeffect(); // many more code here }); </script> <!-- end inline scripts //--> </body> </html>
my questions:
- if i'll use headjs, should put jquery.noconflict(); now? or there no more conflicts if i'll use js library?
- where put inline scripts, in head.ready()? the '$' sign not cause conflicts other libraries?
thanks.
i think you're missing point of head js. here's <head>
element should like:
<head> <meta charset="utf-8" /> <title>title</title> <script src="path/to/head.js"></script> <script> // files loaded in parallel , executed in order arrive head.js('https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js') .js('path/to/other/external.js'), .js('and/so/on'); // call function after scripts have been loaded , document scriptable head.ready(function () { jquery.noconflict(); // inline stuff $ (prototype, not jquery) }); </script> </head>
Comments
Post a Comment