Tuesday, 15 May 2012

javascript - Placement of jQuery -



javascript - Placement of jQuery -

so code below simple slider. wondering why not work when move jquery code bottom (before )?-- works when @ top did reading seems preach placing @ bottom.

<!doctype html> <html> <head> <title>slide panel</title> <link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css" /> <script type="text/javascript" src="script.js"></script> <link rel="stylesheet" type="text/css" href="stylesheet.css"></link> </head> <body> <div class="panel"> <br /> <br /> <p>now see me!</p> </div> <p class="slide"><div class="pull-me">slide up/down</div></p> <script src="http://code.jquery.com/jquery-1.10.2.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script> </body> </html>

because main script, script.js set before declaration of jquery. main script should declared after jquery. can set script.js under jquery script tags @ bottom of page , still work or can set jquery script tags on top of script.js tag @ top of page , still work.

javascript jquery

No comments:

Post a Comment