jQuery网站页面导航特效代码

版权:原创 更新时间:1年以上
[该文章底部包含文件资源,可根据自己情况,决定是否下载资源使用,时间>金钱,如有需要,立即查看资源]

以下是 jQuery网站页面导航特效代码 的示例演示效果:

当前平台(PC电脑)
  • 平台:

部分效果截图:

jQuery网站页面导航特效代码

HTML代码(index.html):

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<!--[if IE]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
	<![endif]-->
	<title>jQuery网站页面导航</title>
	<link rel="stylesheet" href="css/zzsc.css" type="text/css" media="screen, projection" />
	<script type="text/javascript" src="js/jquery-1.9.0.min.js"></script>

<style>
/*  Main  */
body {
 background:#FFF;
 color:#000;
 font-family: 'alfios';
 font-size: 20px;
}
a {
	font-style: normal;
    text-decoration: none;
}
h1 {
	font-size: 50px;
	font-weight: normal;
}
h2 {
    font-size: 27px;
    font-weight: normal;
}
#content p{
	font-size: 50px;
	line-height: 250px;
}
*,
*:after,
*:before {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
    padding: 0;
    margin: 0;
}

::selection {
    background: transparent; 
}

::-moz-selection {
    background: transparent; 
}

.wrapper {
 margin:0 auto;
 width:960px; /*  Change to desired width :)  */
}

#header {
	width: 100%;
	/*background: url('../images/bg1.jpg')*/
}

</style>
</head>

<body>
<!--<ul class="sminqu">
    <li class='serv'><a href="#">&#7463;</a></li>
    <li><a href="#">Предисловие</a></li>
	<li><a href="#">Подготовка шаблона</a></li>
	<li><a href="#">Слои-джедаи</a></li>
	<li><a href="#">Работает?</a></li>
    <li class='serv'><a href="#" >&#7456;</a></li>
</ul>-->
<ul class="sminqu">
    <li><img src="images/appicns_Chrome.png" /></li>
    <li><img src="images/appicns_Firefox.png" /></li>
    <li><img src="images/appicns_Safari.png" /></li>
    <li><img src="images/appicns_Skype.png" /></li>
</ul>

<div id="wrapper">

	<header id="header">
		<strong>Header:</strong> Lorem ipsum dolor sit amet, consectetur 
	adipiscing elit. Cras tortor. Praesent dictum, libero ut tempus dictum, 
	neque eros elementum mauris, quis mollis arcu velit ac diam. Etiam neque. 
	Quisque nec turpis. Aliquam arcu nulla, dictum et, lacinia a, mollis in, 
	ante. Sed eu felis in elit tempor venenatis. Cum sociis natoque penatibus et 
	magnis dis parturient montes, nascetur ridiculus mus. Ut ultricies porttitor 
	purus. Proin non tellus at ligula fringilla tristique. Fusce vehicula quam. 
	Curabitur vel tortor vitae pede imperdiet ultrices. Sed tortor.
	</header><!-- #header-->

	<div id="content">

<p data-mnav="0">empora, dolores, iure amet voluptate expedita odio labore 
aperiam cupiditate iste modi magnam possimus hic sit odit dolor error repellat 
porro.</p>
<p data-mnav="1">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Cum, 
totam quidem suscipit nihil sunt vitae est itaque expedita laudantium 
laboriosam. Culpa, repellendus libero accusantium sint molestias quidem maiores 
voluptates quis!</p>
<p data-mnav="2">Lorem ipsum dolor sit amet, consectetur adipisicing elit. 
Doloribus, asperiores, inventore exercitationem eligendi temporibus ipsum facere 
iure natus obcaecati mollitia. Eaque deleniti est sunt totam odit neque quam. 
Officiis, ipsa?</p>
<p data-mnav="3">Lorem ipsum dolor sit amet, consectetur adipisicing elit. 
Impedit, excepturi maxime magnam! Quo, possimus commodi alias veniam labore 
velit deserunt magnam odit eum autem perferendis voluptate explicabo facere! 
Quod, ipsum.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sunt, incidunt, 
amet, magni, cupiditate ad nam voluptates autem nemo repudiandae eveniet 
reprehenderit enim dolore sed officiis voluptatum sequi hic veniam perspiciatis.</p>


	</div><!-- #content-->

</div><!-- #wrapper -->

<script>
/*if ($('.sm').length > 0) {
$('.sminqu li').each(function(i) { //ul.menu li > a
if(i!=0 && i!=$('ol.cbp-vimenu a').length-1){
    $(this).wrapInner("<a href='#'></a>").click(function(){ 
		$("html, body").animate({
			"scrollTop": $('#nav'+i).offset().top-25
		},"slow");
		return false;
	});

}

if (i == 0){$(this).click(function(){$("html, body").animate({"scrollTop":0},"slow");return false;});}
if(i==$('ol.cbp-vimenu a').length-1){
	$(this).click(function(){$("html, body").animate({"scrollTop":$(document).height()},"slow");return false;});
}
});

$(window).scroll(function(){
$('ol.cbp-vimenu a').each(function(i) { 
if(i!=0 && i!=$('ol.cbp-vimenu a').length-1){
	if ($(window).scrollTop() >= $('#nav'+i).offset().top-25){

        $(this).addClass('cbp-curr');
    }
    else
    {
        $(this).removeClass('cbp-curr');
    }
}
});
});
};*/


// the semi-colon before function invocation is a safety net against concatenated
// scripts and/or other plugins which may not be closed properly.
;(function ( $, window, document, undefined ) {

    // undefined is used here as the undefined global variable in ECMAScript 3 is
    // mutable (ie. it can be changed by someone else). undefined isn't really being
    // passed in so we can ensure the value of it is truly undefined. In ES5, undefined
    // can no longer be modified.

    // window and document are passed through as local variable rather than global
    // as this (slightly) quickens the resolution process and can be more efficiently
    // minified (especially when both are regularly referenced in your plugin).

    // Create the defaults once
    var pluginName = "minqu",
        defaults = {
            autofill: true,
            backlight: true
        };

    // The actual plugin constructor
    function Plugin( element, options ) {
        this.element = element;

        // jQuery has an extend method which merges the contents of two or
        // more objects, storing the result in the first object. The first object
        // is generally empty as we don't want to alter the default options for
        // future instances of the plugin
        this.options = $.extend( {}, defaults, options );

        this._defaults = defaults;
        this._name = pluginName;

        this.init();
    }

    Plugin.prototype = {

        init: function() {
            // Place initialization logic here
            // You already have access to the DOM element and
            // the options via the instance, e.g. this.element
            // and this.options
            // you can add more functions like the one below and
            // call them like so: this.yourOtherFunction(this.element, this.options).
            var $thiselem = this.element;
            if($('*[data-mnav]').length > 0){
                if($('> li', this.element).length > 0){
                $('> li', this.element).each(function(i) { 
                    $(this).wrapInner("<a href='#'></a>").click(function(){ 
                        $("html, body").animate({
                            "scrollTop": $('*[data-mnav="'+i+'"]').offset().top-25
                        },"slow");
                        return false;
                    });
                });
                }
                else if (this.options.autofill){
                    
                    $('*[data-mnav]').each(function(i) {
                        $('> li:last a', $thiselem).append('<li><a href="#">'+i+'</a></li>')
                        .click(function(){ 
                            $("html, body").animate({
                                "scrollTop": $('*[data-mnav="'+i+'"]').offset().top-25
                            },"slow");
                            return false;
                        });
                    });                    
                }
            }else {console.log("minqu: There is no &laquo;data-mnav&raquo; anchors on this page")}
            
            if (this.options.backlight){
                $(window).scroll(function(){
                $('> li', $thiselem).each(function(i) {
                    if ($(window).scrollTop() >= $('*[data-mnav='+i+']').offset().top-25){
                        $(this).addClass('sminqu-curr');
                    }
                    else
                    {
                        $(this).removeClass('sminqu-curr');
                    }
                });
                }); 
            }          
            /*if(this.options.tpbt){
                $(this.element).append('<li name="tpbt"><a href="#">'+this.options.tpbt+'</a></li>')
                .click(function(){$("html, body").animate({"scrollTop":0},"slow");return false;});
            }
            if(this.options.dnbt){
                $(this.element).append('<li name="dnbt"><a href="#">'+this.options.dnbt+'</a></li>')
                .click(function(){$("html, body").animate({"scrollTop":$(document).height()},"slow");return false;});
            }*/                        
        },

        yourOtherFunction: function(el, options) {
            // some logic
        }
    };

    // A really lightweight plugin wrapper around the constructor,
    // preventing against multiple instantiations
    $.fn[pluginName] = function ( options ) {
        return this.each(function () {
            if (!$.data(this, "plugin_" + pluginName)) {
                $.data(this, "plugin_" + pluginName, new Plugin( this, options ));
            }
        });
    };

})( jQuery, window, document );
$('.sminqu').minqu({
    autofill: true,
    backlight: true
});
</script>
</body>
</html>







CSS代码(zzsc.css):

/*MAIN UL STYLE */
.sminqu{font-size:50%;width:7%;position:fixed;overflow:hidden;top:0;left:0;list-style-type:none;margin:2em;padding:0;background:#d13939;/*CHANGE MINQU COLOR*/
 z-index:2;-moz-box-shadow:0 2px 3px rgba(0,0,0,0.4);-webkit-box-shadow:0 2px 3px rgba(0,0,0,0.4);box-shadow:0 2px 3px rgba(0,0,0,0.4);}
.sminqu img{width:70%;}
.sminqu li a{display:block;padding:0.3em;line-height:3em;text-align:center;color:#999;position:relative;border-bottom:1px solid rgba(0,0,0,0.05);-webkit-transition:background 0.1s ease-in-out;-moz-transition:background 0.1s ease-in-out;transition:background 0.1s ease-in-out;}
.sminqu-curr{background:rgba(0,0,0,0.3) !important;}
.sminqu-curr:hover{background:rgba (255,255,255,0.5) !important;color:#fff;}
.sminqu li a:hover{background:rgba(255,255,255,0.3);color:#fff;}
@media screen and (max-width:800px){.sminqu{width:100%;font-size:50%;margin:0;padding:0;display:table;}
.sminqu li{display:table-cell;text-align:center;width:10%;height:1em;}
.sminqu li a{vertical-align:middle;padding:0 0.1em 0 0.1em;line-height:1.2em;height:100%;border-bottom:none;}
}
附件:下载该文件资源,减少时间成本(增值服务)
留言
该资源可下载
File Source
.rar
65.59 KB
Html Js 菜单导航特效3
最新结算
jquery虚拟键盘中文打字效果js代码
类型: .rar 金额: CNY 2.31¥ 状态: 待结算 详细>
jquery虚拟键盘中文打字效果js代码
类型: .rar 金额: CNY 0.29¥ 状态: 待结算 详细>
HTML5实现CSS滤镜图片切换特效代码
类型: .rar 金额: CNY 2.31¥ 状态: 待结算 详细>
jQuery头像裁剪插件cropbox js代码
类型: .rar 金额: CNY 0.29¥ 状态: 待结算 详细>
jQuery头像裁剪插件cropbox js代码
类型: .rar 金额: CNY 2.31¥ 状态: 待结算 详细>
CSS3制作3D图片立方体旋转特效
类型: .rar 金额: CNY 2.31¥ 状态: 待结算 详细>
CSS3制作3D图片立方体旋转特效
类型: .rar 金额: CNY 0.29¥ 状态: 待结算 详细>
CSS3制作3D图片立方体旋转特效
类型: .rar 金额: CNY 2.31¥ 状态: 待结算 详细>
CSS3制作3D图片立方体旋转特效
类型: .rar 金额: CNY 0.29¥ 状态: 待结算 详细>
jQuery+css3实现信封效果
类型: .rar 金额: CNY 0.29¥ 状态: 待结算 详细>
我们力求给您提供有用的文章,再此基础上,会附加营收资源,不做任何广告,让平台可以更好发展 若您发现您的权利被侵害,或使用了您的版权,请发邮件联系 sunlifel@foxmail.com ggbig觉得 : 不提供源码的文章不是好文章
合作伙伴
联系我们
  • QQ:21499807
  • 邮箱:sunlifel@foxmail.com
  • QQ扫一扫加QQ
    QQ扫一扫
Copyright 2023-2024 ggbig.com·皖ICP备2023004211号-1
打赏文章