<script type="text/javascript">
function pageLoad() {
var $scrollingDiv = $("#scrollfix");
$(window).scroll(function () {
if ($(window).scrollTop() == $(document).height() - $(window).height()) {
__doPostBack('<%= GetMoreResults.UniqueID %>', '');
}
$scrollingDiv
.stop()
.animate({ "marginTop": ($(window).scrollTop()) + -60 + "px" }, "slow");
});
}
</script>
This code does not execute at all, the reason i'm using the pageLoad function is because the jquery code failed to execute after updatepanel partial postback. But then after using this one, none of the code above works even on first page startup.
However, the code that USED to work on page load is below but the jquery part STOPPED working after postback:
$(document).ready(function () {
$().ready(function () {
var $scrollingDiv = $("#scrollfix");
$(window).scroll(function () {
if ($(window).scrollTop() == $(document).height() - $(window).height()) {
__doPostBack('<%= GetMoreResults.UniqueID %>', '');
}
$scrollingDiv
.stop()
.animate({ "marginTop": ($(window).scrollTop()) + -60 + "px" }, "slow");
});
});
});
Solutions? Thanks alot.
UPDATE #2
This is my current code: It works the first time the page loads, but not after the partial postback trigger by the __doPostBack.
<script type="text/javascript">
window.load = pageLoad();
function pageLoad() {
var $scrollingDiv = $("#scrollfix");
$(window).scroll(function () {
if ($(window).scrollTop() == $(document).height() - $(window).height()) {
__doPostBack('<%= GetMoreResults.UniqueID %>', '');
}
$scrollingDiv
.stop()
.animate({ "marginTop": eval($(window).scrollTop()) + -60 + "px" }, "slow");
});
}
</script>
UPDATE #3
I should mention that this page does not inherit from Page, I've made a custom page class called BasePage : Page.
Maybe pageLoad() does not fire for some reason related to this?