JavaScript 自定义Mootools滚动

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JavaScript 自定义Mootools滚动相关的知识,希望对你有一定的参考价值。

<script type="text/javascript">

window.addEvent('domready', function() {

	if ( ($('container_Scroll_content').getSize().size.y) > ($('container_Scroll').getSize().size.y) ) {

		myScrollFx = new Fx.Scroll('container_Scroll', {
			wait: false
		});
		mySlide = new Slider($('areaScroll'), $('knobScroll'), {
			steps: $('container_Scroll_content').getSize().size.y-($('container_Scroll').getSize().size.y),
			mode: 'vertical',
			onChange: function(step){
				$('container_Scroll').scrollTo(0,step);
			}
		}).set(0);
		
	}
	else {
		$('areaScroll').setStyle('visibility','hidden');
	}
	
});

document.addEvent('mousewheel', function(e) {
        e = new Event(e).stop();
        var step = mySlide.step - e.wheel * 10;
        mySlide.set(step);
});

</script>



<div id="container_Scroll">
<div class="text10pxWhite" id="container_Scroll_content">
THE END
</div>
</div>
<div id="areaScroll">
<div id="knobScroll"></div>
</div> 




#knobScroll{
	height: 25px;
	width: 15px;
	background-image:url(_images/slide.gif);
	background-repeat:no-repeat;
	cursor: pointer;
}
#areaScroll {
	/*background-image:url(../_images/bg_slider.gif);
	background-repeat:repeat-y;*/
	background-color:#4b4a43;
	height: 340px;
	width: 15px;
	float:right;
}

#container_Scroll {
	margin:0px;
	width: 500px;
	height: 340px;
	overflow:hidden;
	float:left;
}

#container_Scroll_content {
	padding:0px;
	margin:0px;
	width: 500px;
}

以上是关于JavaScript 自定义Mootools滚动的主要内容,如果未能解决你的问题,请参考以下文章

MooTools自定义事件

为MooTools 1.2创建一个自定义的伪选择器

[MooTools]轻松滚动到底部

MooTools图像滚动

JavaScript自定义滚动条

Mootools公司:Fx.滚动将页面移到顶部