Try adding the function to a var
Code:
/**
* Document : web-app.js
* Author : aka (InsiteFX)
*
* save as : js/web-app.js
*/
var webApp = function() {
/* Scroll to top functionality */
var scrollToTop = function() {
// Get link
var link = $('#to-top');
$(window).scroll(function() {
// If scrolled 150 pixels show the link
if ($(this).scrollTop() > 150) {
link.fadeIn(100);
} else {
link.fadeOut(100);
}
});
// On click go to top of page
link.click(function() {
$('html, body').animate({scrollTop: 0}, 200);
return false;
});
};
// Initialize all functions here by name...
return {
init: function() {
// Scroll to top (var scrollToTop = function(){})
scrollToTop();
// add other functions below here.
}
};
}();
// Initialize WebApp when page first loads
$(function() {
webApp.init();
});
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )