Hello all,
I am reading an online tutorial that says if the <script></script> is right on top of </body> the $(document).ready is not necessary b/c the document has been loaded at that moment.
Q1> Is that true?
Q2>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"></script>
<script src="jquery.viewport.min.js"></script>
<script>
$(window).scroll(function() { // this line will track all mouse scroll event
});
</script>
What does the $(window) mean? Is this a jquery selector? If it is, then the previous claim looks correct because we don't have to include this inside
$(document).ready(function() {
});
Q3> why we use $link here? why we choose to use $link rather than var link?
<script>
$(window).scroll(function() {
$link = $('nav a[hash=#first]');
$link.addClass('selected');
});
</script>
Thank you