I'd like to create a custom .js file for my website so that I do not have to keep linking it within my webpages, my code works when used inline .
Please could someone tell me why my styles.js page wont link? I'm thinking that my code is wrong?
The current page is 'styles.js', the link I use is:
$(document).ready(function() {
$('#nav').affix({
offset: {
top: 90
}
});
$('#sidebar').affix({
offset: {
top: 17
}
});
});
$(document).ready(function() {
$(window).scroll(function() {
if ($(this).scrollTop() > 50) {
$('#back-to-top').fadeIn();
} else {
$('#back-to-top').fadeOut();
}
});
// scroll body to 0px on click
$('#back-to-top').click(function() {
$('#back-to-top').tooltip('hide');
$('body,html').animate({
scrollTop: 0
}, 800);
return false;
});
$('#back-to-top').tooltip('show');
});