I am new to jquery and this code will do as expected scroll to my div called bottom, but will run every time on page load and when you click any button which causes a postback
$(function ScrollToPhotos() {
$('html, body').animate({
scrollTop: $('#bottom').offset().top
}, 'fast');
});
To make the above work on a particular button press, I use the following
$(function () {
function ScrollToPhotos() {
$('html, body').animate({
scrollTop: $('#bottom').offset().top
}, 'fast');
};
But the ScrollToPhotos is greyed out and does not run, and have an
OnClienClick = "ScrollToPhotos()"; set up on a button to call the function
I tried to run the above last bit of code without the $ (function () it was called by the onclick button but does not scroll.
any ideas please,
thanks