Toggle navigation
在线编辑器
在线代码
文本比较
jQuery下载
前端库
在线手册
登录/注册
下载代码
html
css
js
分享到微信朋友圈
X
html
Scroll
1
2
3
4
5
6
7
css
@import url(https://fonts.googleapis.com/css?family=Squada+One); * { box-sizing: border-box; } body { background: #000; padding: 0px; margin: 0px; } nav { background: rgba(0, 0, 0, 0.8); padding: 18px; position: fixed; bottom: 50px; height: 55px; left: 50%; width: 800px; margin-left: -400px; z-index: 3; } nav .wrapper { padding: 0; width: 785px; } nav .wrapper, nav svg { height: 100%; } nav svg { margin-right: 15px; cursor: pointer; height: 20px; width: 30px; float: left; } nav svg path, nav svg rect { fill: #fff; } nav .nodes { position: relative; margin-top: -5px; margin-left: 5px; float: left; } .line { position: absolute; width: 705px; height: 1px; top: 14px; } .line .red, .line .blue { width: 100%; height: 1px; } .line .red-container { overflow: hidden; height: 1px; width: 58px; } .line .red { background-color: #4b1202; *zoom: 1; filter: progid:DXImageTransform.Microsoft.gradient(gradientType=1, startColorstr='#FF4B1202', endColorstr='#FFFD8107'); background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjAuMCIgeTE9IjAuNSIgeDI9IjEuMCIgeTI9IjAuNSI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZkODEwNyIvPjxzdG9wIG9mZnNldD0iMTYlIiBzdG9wLWNvbG9yPSIjZmQ4MTA3Ii8+PHN0b3Agb2Zmc2V0PSI1OCUiIHN0b3AtY29sb3I9IiNlMDNhMGQiLz48c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNmZDgxMDciLz48L2xpbmVhckdyYWRpZW50PjwvZGVmcz48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSJ1cmwoI2dyYWQpIiAvPjwvc3ZnPiA='); background-size: 100%; background-image: -webkit-gradient(linear, 0% 50%, 100% 50%, color-stop(0%, #fd8107), color-stop(16%, #fd8107), color-stop(58%, #e03a0d), color-stop(100%, #fd8107)); background-image: -moz-linear-gradient(left, #fd8107 0%, #fd8107 16%, #e03a0d 58%, #fd8107 100%); background-image: -webkit-linear-gradient(left, #fd8107 0%, #fd8107 16%, #e03a0d 58%, #fd8107 100%); background-image: linear-gradient(to right, #fd8107 0%, #fd8107 16%, #e03a0d 58%, #fd8107 100%); } .line .blue { background-color: #232e3a; *zoom: 1; filter: progid:DXImageTransform.Microsoft.gradient(gradientType=1, startColorstr='#FF232E3A', endColorstr='#FF446B95'); background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjAuMCIgeTE9IjAuNSIgeDI9IjEuMCIgeTI9IjAuNSI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzIzMmUzYSIvPjxzdG9wIG9mZnNldD0iMjklIiBzdG9wLWNvbG9yPSIjNWM3ZDlmIi8+PHN0b3Agb2Zmc2V0PSI1NSUiIHN0b3AtY29sb3I9IiMxODM3NTciLz48c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiM0NDZiOTUiLz48L2xpbmVhckdyYWRpZW50PjwvZGVmcz48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSJ1cmwoI2dyYWQpIiAvPjwvc3ZnPiA='); background-size: 100%; background-image: -webkit-gradient(linear, 0% 50%, 100% 50%, color-stop(0%, #232e3a), color-stop(29%, #5c7d9f), color-stop(55%, #183757), color-stop(100%, #446b95)); background-image: -moz-linear-gradient(left, #232e3a 0%, #5c7d9f 29%, #183757 55%, #446b95 100%); background-image: -webkit-linear-gradient(left, #232e3a 0%, #5c7d9f 29%, #183757 55%, #446b95 100%); background-image: linear-gradient(to right, #232e3a 0%, #5c7d9f 29%, #183757 55%, #446b95 100%); } .node { margin-left: 90px; width: 20px; height: 20px; margin-top: 5px; float: left; margin-right: -10px; position: relative; } .node .splash { box-shadow: 0px 0px 8px 2px rgba(69, 174, 233, 0.53); transform: translateZ(0px) scale(1); position: absolute; width: 20px; height: 20px; border-radius: 100%; pointer-events: none; opacity: 1; } .node.active .active-circle { transform: scale(1); opacity: 1; } .node.active .splash { transition: transform 1200ms, opacity 1500ms; transform: translateZ(0px) scale(2.5); opacity: 0 !important; } .node.active .inactive-circle { transition: opacity 200ms; opacity: 0; } .node .active-circle { transition: all 300ms cubic-bezier(0.63, 0.62, 0.48, 1.84); transform: scale(0.7); position: absolute; opacity: 0; width: 20px; height: 20px; border-radius: 100%; background-color: #4b1202; *zoom: 1; filter: progid:DXImageTransform.Microsoft.gradient(gradientType=1, startColorstr='#FF4B1202', endColorstr='#FFFD8107'); background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjAuMCIgeTE9IjEuMCIgeDI9IjEuMCIgeTI9IjAuMCI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzRiMTIwMiIvPjxzdG9wIG9mZnNldD0iNjAlIiBzdG9wLWNvbG9yPSIjZTAzYTBkIi8+PHN0b3Agb2Zmc2V0PSIxMDAlIiBzdG9wLWNvbG9yPSIjZmQ4MTA3Ii8+PC9saW5lYXJHcmFkaWVudD48L2RlZnM+PHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idXJsKCNncmFkKSIgLz48L3N2Zz4g'); background-size: 100%; background-image: -webkit-gradient(linear, 0% 100%, 100% 0%, color-stop(0%, #4b1202), color-stop(60%, #e03a0d), color-stop(100%, #fd8107)); background-image: -moz-linear-gradient(left bottom, #4b1202 0%, #e03a0d 60%, #fd8107 100%); background-image: -webkit-linear-gradient(left bottom, #4b1202 0%, #e03a0d 60%, #fd8107 100%); background-image: linear-gradient(to right top, #4b1202 0%, #e03a0d 60%, #fd8107 100%); } .node .active-circle .cover { transform: translateZ(0px); width: 16px; height: 16px; background: black; border-radius: 100%; position: absolute; top: 2px; left: 2px; } .node .active-circle .white { transition: all 300ms cubic-bezier(0.63, 0.62, 0.48, 1.84); width: 6px; height: 6px; background: #fff; border-radius: 100%; position: absolute; transform: translateX(5px) translateY(5px) scale(1); } .node .inactive-circle { transition: all 300ms cubic-bezier(0.63, 0.62, 0.48, 1.84); width: 14px; height: 14px; display: block; background: #000; position: absolute; border-radius: 100%; border: 2px solid #5489b1; top: 3px; left: 3px; } .node:hover { cursor: pointer; } .node:hover .active-circle { transition: all 200ms cubic-bezier(0.63, 0.62, 0.48, 1.84); transform: scale(0.84); } .node:hover .active-circle .white { transition: all 200ms cubic-bezier(0.63, 0.62, 0.48, 1.84); transform: translateX(4.7px) translateY(5px) scale(1.42); } .node:hover .inactive-circle { transition: all 200ms cubic-bezier(0.63, 0.62, 0.48, 1.84); transform: scale(0.85); } .items { position: relative; } .items .item { position: relative; width: 100%; height: 100%; } .items .item span { font-family: 'Squada One', cursive; color: #fff; display: block; height: 200px; width: 400px; margin: auto; position: absolute; top: 0; left: 0; bottom: 0; right: 0; text-align: center; font-size: 160px; }
JavaScript
$( '.item' ).height( window.innerHeight ); var $document = $( document.body ); var $revealBar = $( '.red-container' ); var wrapperHeight = $document.height(); var stepDistance = 101; var documentHeight = window.innerHeight; var positions = []; var heights = []; var elements = $( '.item:not(".main")' ); // Cache heights and positions for( var i = 0; i < elements.length; i++ ) { var $element = $(elements[i]); var height = $element.offset().top + documentHeight; if (height > wrapperHeight) { height = wrapperHeight; } positions.push(height); heights.push($element.height()); } var $nodes = $( '.node' ); // Should totally be debounced /w animation frame. I know, // this whole thing is slightly inefficient. // And magic numbers too! $( document ).scroll( function() { nodeTop = $document.scrollTop() + documentHeight + 1; var current = 0; // Active/non active states for( var i = 0; i < positions.length; i++ ) { if(nodeTop > positions[i]) { current = i; $nodes.eq( i ).addClass( 'active' ); } else { $nodes.eq( i ).removeClass( 'active' ); } } // Bar positioning, so sections can have different heights. var distanceToNext = 0; // Initial node, already has some of the bar filled. if( nodeTop < positions[0] ) { var nextStep = (nodeTop - positions[current]) / (positions[current + 1] - positions[current]); // Calculating for node widths. var totalWidth = ((stepDistance) + ( current * stepDistance ) + (nextStep * stepDistance)) * 0.4; $revealBar.width( (0.6 * stepDistance) + totalWidth ); // Final node covered. } else if (nodeTop > positions[6]) { $revealBar.width(stepDistance * (current + 1)); // regular nodes } else if ( current < elements.length ) { var nextStep = (nodeTop - positions[current]) / (positions[current + 1] - positions[current]); var totalWidth = stepDistance + ( current * stepDistance ) + (nextStep * stepDistance); $revealBar.width( totalWidth ); } }) // Clicking the nodes... again, nothing special ;) $nodes.each( function( index ) { var $node = $( this ); $node.click( function() { $('html, body').animate({ scrollTop: (positions[ index ] - documentHeight + 10)}, 1000 ); }); })
粒子
时间
文字
hover
canvas
3d
游戏
音乐
火焰
水波
轮播图
鼠标跟随
动画
css
加载动画
导航
菜单
按钮
滑块
tab
弹出层
统计图
svg
×
Close
在线代码下载提示
开通在线代码永久免费下载,需支付20jQ币
开通后,在线代码模块中所有代码可终身免费下!
您已开通在线代码永久免费下载,关闭提示框后,点下载代码可直接下载!
您已经开通过在线代码永久免费下载
对不起,您的jQ币不足!可通过发布资源 或
直接充值获取jQ币
取消
开通下载
<!doctype html> <html> <head> <meta charset="utf-8"> <title>垂直滚动导航-jq22.com</title> <script src="https://www.jq22.com/jquery/jquery-1.10.2.js"></script> <style>
</style> </head> <body>
<script>
</script>
</body> </html>
2012-2021 jQuery插件库版权所有
jquery插件
|
jq22工具库
|
网页技术
|
广告合作
|
在线反馈
|
版权声明
沪ICP备13043785号-1
浙公网安备 33041102000314号