"Back to top" with mootools
Can anyone give me a similar script for mootools. I'm using jquery and I need a similar function like this to use with mootools:
$(document).ready(function(){
if( $(".page")开发者_如何学JAVA.height() < $(window).height() ) {
$(".backtop").hide();
}
else {
$(".backtop").show();
}
});
What I want is a "back to top" button that only appears when the div.page is bigger than the screen window.
$$('a.backtop').setStyle('display',
document.getElement('div.page').getSize().y > window.getSize().y ? 'block' : 'none'
);
note sometimes on old ie you might have to wrap $(window) or $(document).
http://jsfiddle.net/wD6RY/
window.addEvent('domready', function() {
($('div.page')> window.getSize().y) ? $('div.backtop').fade(1) : $('div.backtop').fade(0)
});
精彩评论