<script src="JS/jquery-1.7.1.js"
type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function()
{
var
ROOT = (function() {
var
html = document.documentElement;
var
htmlScrollTop = html.scrollTop++;
var
root = html.scrollTop == htmlScrollTop + 1 ? html : document.body;
html.scrollTop = htmlScrollTop;
return
root;
})();
// may be
recalculated on resize
var
limit = (document.body.scrollHeight - $(window).height()) * 0.85;
var
visible = false;
var
last = +new Date;
var
didScroll = false;
$(window).scroll(function() {
didScroll = true;
})
setInterval(function()
{
if
(didScroll) {
didScroll = false;
if
(visible && ROOT.scrollTop < limit) {
hideCredit();
visible = false;
} else
if (!visible && ROOT.scrollTop > limit)
{
showCredit();
visible = true;
}
}
}, 30);
function
hideCredit() {
console.log('The hideCredit function has been called.');
alert("hide");
}
function
showCredit() {
console.log('The showCredit function has been called.');
alert("show");
}
});
</script>
No comments:
Post a Comment