html 在Rainmaker站点上滚动视差部分的解决方法。允许创建点击进入“继续阅读”按钮。

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html 在Rainmaker站点上滚动视差部分的解决方法。允许创建点击进入“继续阅读”按钮。相关的知识,希望对你有一定的参考价值。

<!-- 
Button links with a data-section attribute can be used in
text content areas to autoscroll to the first element with 
the class name specified in data-section.
-->

<!-- Home Section 1 text widget: -->
<a class="button" href="#" data-section="home-section-2">Continue Reading</a>

<!-- Home Section 2 text widget -->
<a class="button" href="#" data-section="home-section-3">Continue Reading</a>

<!-- Home Section 3 text widget -->
<a class="button" href="#" data-section="home-section-4">Continue Reading</a>

<!-- Home Section 4 text widget -->
<a class="button" href="#" data-section="home-section-5">Continue Reading</a>
<!-- Buttons without the data-section attribute will be treated like regular links (no scroll) -->
<a class="button" href="http://example.com/contact/">Get in touch</a>
<script>
// This script goes in Design > Appearance > Scripts > Footer Scripts
// Be sure to copy the opening and closing script tags too.
jQuery(function ($) {
	$(".home .button").click(function (e) {
		var elementToScrollTo = $(this).data('section');
		
		if (!elementToScrollTo) return;
		
		$('html, body').animate({
			scrollTop: $('.' + elementToScrollTo).offset().top
		}, 1000);
		e.preventDefault();
	});
});
</script>

以上是关于html 在Rainmaker站点上滚动视差部分的解决方法。允许创建点击进入“继续阅读”按钮。的主要内容,如果未能解决你的问题,请参考以下文章

html 固定在特定滚动偏移上的视差

视差双向滚动

CSS3动画之视差滚动

背景图像与视差

iOS开发之视差滚动视图

滚动视差让你不相信“眼见为实”