jQuery的几种简单实用效果

许久未分享博客,或许已生疏。

闲来无事,

分享几个jQuery简单实用的效果案例

不喜勿喷...

1、页面常用的返回顶部

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>返回顶部</title>
    <style type="text/css">
         *{
             margin: 0;
             padding: 0;
         }
         .wrap{
             height: 2000px;
         }
         .gotop{
             display: block;
             width: 32px;
             height: 32px;
             background-color: red;
             text-align: center;
             text-decoration: none;
             font-size: 14px;
             font-weight: bold;
             color: white;
             line-height: 32px;
             position: fixed;
             right:50px;
             bottom:50px;
             opacity: 0;
             /*top: 500px;*/
         }
    </style>
</head>
<body>
      <div class="wrap">
             <a href="###" class="gotop">TOP</a>
      </div>
      <script type="text/javascript" src="jquery-1.11.3.min.js"></script>
      <script type="text/javascript">
        $(function(){
                 // 当滚动条滚动大于200时出现,未大于,消失
                 $(window).scroll(function(){
                     if($(document).scrollTop()<200){
                         // alert("kk");
                         $(".gotop").stop().animate({

                                  opacity: 0

                         },1000)
                     }
                     else{
                         $(".gotop").show().stop().animate({

                                  opacity: 1

                         },1000)
                     }
                })
             // 返回顶部
             $(".gotop").on("click",function(){
                   $("html body").animate({
                          scrollTop:0
                   },1000)
             })
        })
      </script>
</body>
</html>

2、tab切换 on

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>jQuery tab切换</title>
	<style type="text/css">
        *{
        	margin:0;
        	padding:0;
        }
        .wrap{
        	margin-left: 50px;
        	margin-top: 50px;
        }
        /*清浮动---clearfix*/
        .clearfix {
			*zoom: 1;
		}
		.clearfix:after {
			content: "";
			clear: both;
			display: block;
			height: 0;
			font-size: 0;
			visibility: hidden;
		}
        .blist {
        	border:1px solid #d9d9d9;
        	width: 275px;
        	height: 32px;
        }
        .blist  li:first-child{
        	border-left: none;
        }
        .blist  li{
              list-style: none;
              width: 68px;
              height: 32px;
              border-left:1px solid #d9d9d9;
              font-size: 14px;
              font-family: "楷体";
              line-height: 32px;
              text-align: center;
              float: left;
              /*鼠标样式改变为一个手*/
              cursor: pointer;
			  /*字体免选中*/
			  -webkit-user-select: none;

        }
        .blsit-list{
        	width: 275px;
        }
        .blsit-list li{
              list-style: none;
              width: 275px;
              border:1px solid #ccc;
              height: 200px;
              border-top: none;
        }
        .wrap .blist li.active{
            font-weight: bold;
            color: red;
            border-top: 2px solid red;
            position: relative;
            top:-1px;
            height: 31px;
        }
        .blsit-list li:first-child{
        	display: block;
        }
       .blsit-list li{
       	  display: none;
       }
	</style>
</head>
<body>
	   <div class="wrap">
	   	     <ul class="blist clearfix">
	   	     	 <li class="active">电影</li>
	   	     	 <li>电脑</li>
	   	     	 <li>冰箱</li>
	   	     	 <li>空调</li>
	   	     </ul>
	   	      <ul class="blsit-list">
	   	      	  <li>A</li>
	   	      	  <li>B</li>
	   	      	  <li>C</li>
	   	      	  <li>D</li>
	   	      </ul>
	   </div>
	    <div class="wrap">
	   	     <ul class="blist clearfix">
	   	     	 <li class="active">电影</li>
	   	     	 <li>电脑</li>
	   	     	 <li>冰箱</li>
	   	     	 <li>空调</li>
	   	     </ul>
	   	      <ul class="blsit-list">
	   	      	  <li>A</li>
	   	      	  <li>B</li>
	   	      	  <li>C</li>
	   	      	  <li>D</li>
	   	      </ul>
	   </div>
	   <div class="wrap">
	   	     <ul class="blist clearfix">
	   	     	 <li class="active">电影</li>
	   	     	 <li>电脑</li>
	   	     	 <li>冰箱</li>
	   	     	 <li>空调</li>
	   	     </ul>
	   	      <ul class="blsit-list">
	   	      	  <li>A</li>
	   	      	  <li>B</li>
	   	      	  <li>C</li>
	   	      	  <li>D</li>
	   	      </ul>
	   </div>
	   <div class="wrap">
	   	     <ul class="blist clearfix">
	   	     	 <li class="active">电影</li>
	   	     	 <li>电脑</li>
	   	     	 <li>冰箱</li>
	   	     	 <li>空调</li>
	   	     </ul>
	   	      <ul class="blsit-list">
	   	      	  <li>A</li>
	   	      	  <li>B</li>
	   	      	  <li>C</li>
	   	      	  <li>D</li>
	   	      </ul>
	   </div>
	   <script type="text/javascript" src="jquery-1.11.3.min.js"></script>
	   <script type="text/javascript">
       $(function(){
       	     $(".blist").on("click","li",function(){
       	     	  // 设index为当前点击
       	     	  var index = $(this).index();
       	     	  // 点击添加样式利用siblings清除其他兄弟节点样式
       	     	  $(this).addClass("active").siblings().removeClass("active");
       	     	  // 同理显示与隐藏
       	     	  $(this).parents(".wrap").find(".blsit-list li").eq(index).show().siblings().hide();
       	     })
       })
	   </script>
</body>
</html>

  3、tab切换 mouseenter

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>jQuery tab切换</title>
	<style type="text/css">
        *{
        	margin:0;
        	padding:0;
        }
        .wrap{
        	margin-left: 50px;
        	margin-top: 50px;
        }
        /*清浮动---clearfix*/
        .clearfix {
			*zoom: 1;
		}
		.clearfix:after {
			content: "";
			clear: both;
			display: block;
			height: 0;
			font-size: 0;
			visibility: hidden;
		}
        .blist {
        	border:1px solid #d9d9d9;
        	width: 275px;
        	height: 32px;
        }
        .blist  li:first-child{
        	border-left: none;
        }
        .blist  li{
              list-style: none;
              width: 68px;
              height: 32px;
              border-left:1px solid #d9d9d9;
              font-size: 14px;
              font-family: "楷体";
              line-height: 32px;
              text-align: center;
              float: left;
              /*鼠标样式改变为一个手*/
              cursor: pointer;
			  /*字体免选中*/
			  -webkit-user-select: none;

        }
        .blsit-list{
        	width: 275px;
        }
        .blsit-list li{
              list-style: none;
              width: 275px;
              border:1px solid #ccc;
              height: 200px;
              border-top: none;
        }
        .wrap .blist li.active{
            font-weight: bold;
            color: red;
            border-top: 2px solid red;
            position: relative;
            top:-1px;
            height: 31px;
        }
        .blsit-list li:first-child{
        	display: block;
        }
       .blsit-list li{
       	  display: none;
       }
	</style>
</head>
<body>
	   <div class="wrap">
	   	     <ul class="blist clearfix">
	   	     	 <li class="active">电影</li>
	   	     	 <li>电脑</li>
	   	     	 <li>冰箱</li>
	   	     	 <li>空调</li>
	   	     </ul>
	   	      <ul class="blsit-list">
	   	      	  <li>A</li>
	   	      	  <li>B</li>
	   	      	  <li>C</li>
	   	      	  <li>D</li>
	   	      </ul>
	   </div>
	    <div class="wrap">
	   	     <ul class="blist clearfix">
	   	     	 <li class="active">电影</li>
	   	     	 <li>电脑</li>
	   	     	 <li>冰箱</li>
	   	     	 <li>空调</li>
	   	     </ul>
	   	      <ul class="blsit-list">
	   	      	  <li>A</li>
	   	      	  <li>B</li>
	   	      	  <li>C</li>
	   	      	  <li>D</li>
	   	      </ul>
	   </div>
	   <div class="wrap">
	   	     <ul class="blist clearfix">
	   	     	 <li class="active">电影</li>
	   	     	 <li>电脑</li>
	   	     	 <li>冰箱</li>
	   	     	 <li>空调</li>
	   	     </ul>
	   	      <ul class="blsit-list">
	   	      	  <li>A</li>
	   	      	  <li>B</li>
	   	      	  <li>C</li>
	   	      	  <li>D</li>
	   	      </ul>
	   </div>
	   <div class="wrap">
	   	     <ul class="blist clearfix">
	   	     	 <li class="active">电影</li>
	   	     	 <li>电脑</li>
	   	     	 <li>冰箱</li>
	   	     	 <li>空调</li>
	   	     </ul>
	   	      <ul class="blsit-list">
	   	      	  <li>A</li>
	   	      	  <li>B</li>
	   	      	  <li>C</li>
	   	      	  <li>D</li>
	   	      </ul>
	   </div>
	   <script type="text/javascript" src="jquery-1.11.3.min.js"></script>
	   <script type="text/javascript">
       $(function(){
       	      $(".blist li").on("mouseenter",function(){
       	     	 var index = $(this).index();
       	     	  $(this).addClass("active").siblings().removeClass("active");
       	     	  $(this).parents(".wrap").find(".blsit-list li").eq(index).show().siblings().hide();
       	     })
       })
	   </script>
</body>
</html>

  4、右栏菜单、

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>右侧栏菜单</title>
	<style type="text/css">
           *{
           	margin: 0;
           	padding: 0;
           }
           .wrap{
           	width: 500px;
           }
           .block{
           	 border:1px solid #ccc;
           	 margin: 20px 20px;
           }
           .rightMenu{
           	 position: fixed;
           	 right: 50px;
           	 top: 200px;
           	 /*opacity: 0;*/
           	 display: none;
           }
           .rightMenu li{
                list-style: none;
                display: block;
                width: 80px;
                height: 32px;
                line-height: 32px;
                text-align: center;
                border: 1px solid blue;
                margin:  5px 0px;

           }
           .rightMenu  li a{
                text-decoration: none;
                color: black;

           }
	</style>
</head>
<body>
      <div class="wrap">
		  <div class="block block1">
		       <h4>第一部分</h4>
		  	   <p>
		  	   	Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab ea labore, doloremque eaque veritatis consectetur distinctio ipsam, perferendis cum expedita assumenda minus! Magnam itaque dolorum dignissimos, ullam asperiores! Deleniti, rem?
		  	   	Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia porro assumenda voluptas exercitationem velit architecto nobis id odit ullam ut ex minima earum expedita distinctio nam culpa, harum, error veniam!
		  	   		Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab ea labore, doloremque eaque veritatis consectetur distinctio ipsam, perferendis cum expedita assumenda minus! Magnam itaque dolorum dignissimos, ullam asperiores! Deleniti, rem?
		  	   	Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia porro assumenda voluptas exercitationem velit architecto nobis id odit ullam ut ex minima earum expedita distinctio nam culpa, harum, error veniam!
		  	   		Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab ea labore, doloremque eaque veritatis consectetur distinctio ipsam, perferendis cum expedita assumenda minus! Magnam itaque dolorum dignissimos, ullam asperiores! Deleniti, rem?
		  	   	Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia porro assumenda voluptas exercitationem velit architecto nobis id odit ullam ut ex minima earum expedita distinctio nam culpa, harum, error veniam!
		  	   		Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab ea labore, doloremque eaque veritatis consectetur distinctio ipsam, perferendis cum expedita assumenda minus! Magnam itaque dolorum dignissimos, ullam asperiores! Deleniti, rem?
		  	   	Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia porro assumenda voluptas exercitationem velit architecto nobis id odit ullam ut ex minima earum expedita distinctio nam culpa, harum, error veniam!
		  	   		Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab ea labore, doloremque eaque veritatis consectetur distinctio ipsam, perferendis cum expedita assumenda minus! Magnam itaque dolorum dignissimos, ullam asperiores! Deleniti, rem?
		  	   	Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia porro assumenda voluptas exercitationem velit architecto nobis id odit ullam ut ex minima earum expedita distinctio nam culpa, harum, error veniam!
		  	   </p>
		  </div>
		  <div class="block block2">
		       <h4>第二部分</h4>
		  	   <p>
		  	   Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab ea labore, doloremque eaque veritatis consectetur distinctio ipsam, perferendis cum expedita assumenda minus! Magnam itaque dolorum dignissimos, ullam asperiores! Deleniti, rem?
		  	   	Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia porro assumenda voluptas exercitationem velit architecto nobis id odit ullam ut ex minima earum expedita distinctio nam culpa, harum, error veniam!
		  	   		Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab ea labore, doloremque eaque veritatis consectetur distinctio ipsam, perferendis cum expedita assumenda minus! Magnam itaque dolorum dignissimos, ullam asperiores! Deleniti, rem?
		  	   	Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia porro assumenda voluptas exercitationem velit architecto nobis id odit ullam ut ex minima earum expedita distinctio nam culpa, harum, error veniam!
		  	   		Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab ea labore, doloremque eaque veritatis consectetur distinctio ipsam, perferendis cum expedita assumenda minus! Magnam itaque dolorum dignissimos, ullam asperiores! Deleniti, rem?
		  	   	Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia porro assumenda voluptas exercitationem velit architecto nobis id odit ullam ut ex minima earum expedita distinctio nam culpa, harum, error veniam!
		  	   		Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab ea labore, doloremque eaque veritatis consectetur distinctio ipsam, perferendis cum expedita assumenda minus! Magnam itaque dolorum dignissimos, ullam asperiores! Deleniti, rem?
		  	   	Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia porro assumenda voluptas exercitationem velit architecto nobis id odit ullam ut ex minima earum expedita distinctio nam culpa, harum, error veniam!
		  	   		Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab ea labore, doloremque eaque veritatis consectetur distinctio ipsam, perferendis cum expedita assumenda minus! Magnam itaque dolorum dignissimos, ullam asperiores! Deleniti, rem?
		  	   	Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia porro assumenda voluptas exercitationem velit architecto nobis id odit ullam ut ex minima earum expedita distinctio nam culpa, harum, error veniam!
		  	   	Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab ea labore, doloremque eaque veritatis consectetur distinctio ipsam, perferendis cum expedita assumenda minus! Magnam itaque dolorum dignissimos, ullam asperiores! Deleniti, rem?
		  	   	Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia porro assumenda voluptas exercitationem velit architecto nobis id odit ullam ut ex minima earum expedita distinctio nam culpa, harum, error veniam!
		  	   </p>
		  </div>
		  <div class="block block3">
		       <h4>第三部分</h4>
		  	   <p>
		  	   Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab ea labore, doloremque eaque veritatis consectetur distinctio ipsam, perferendis cum expedita assumenda minus! Magnam itaque dolorum dignissimos, ullam asperiores! Deleniti, rem?
		  	   	Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia porro assumenda voluptas exercitationem velit architecto nobis id odit ullam ut ex minima earum expedita distinctio nam culpa, harum, error veniam!
		  	   		Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab ea labore, doloremque eaque veritatis consectetur distinctio ipsam, perferendis cum expedita assumenda minus! Magnam itaque dolorum dignissimos, ullam asperiores! Deleniti, rem?
		  	   	Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia porro assumenda voluptas exercitationem velit architecto nobis id odit ullam ut ex minima earum expedita distinctio nam culpa, harum, error veniam!
		  	   		Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab ea labore, doloremque eaque veritatis consectetur distinctio ipsam, perferendis cum expedita assumenda minus! Magnam itaque dolorum dignissimos, ullam asperiores! Deleniti, rem?
		  	   	Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia porro assumenda voluptas exercitationem velit architecto nobis id odit ullam ut ex minima earum expedita distinctio nam culpa, harum, error veniam!
		  	   		Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab ea labore, doloremque eaque veritatis consectetur distinctio ipsam, perferendis cum expedita assumenda minus! Magnam itaque dolorum dignissimos, ullam asperiores! Deleniti, rem?
		  	   	Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia porro assumenda voluptas exercitationem velit architecto nobis id odit ullam ut ex minima earum expedita distinctio nam culpa, harum, error veniam!
		  	   		Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab ea labore, doloremque eaque veritatis consectetur distinctio ipsam, perferendis cum expedita assumenda minus! Magnam itaque dolorum dignissimos, ullam asperiores! Deleniti, rem?
		  	   	Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia porro assumenda voluptas exercitationem velit architecto nobis id odit ullam ut ex minima earum expedita distinctio nam culpa, harum, error veniam!
		  	   	Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab ea labore, doloremque eaque veritatis consectetur distinctio ipsam, perferendis cum expedita assumenda minus! Magnam itaque dolorum dignissimos, ullam asperiores! Deleniti, rem?
		  	   	Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia porro assumenda voluptas exercitationem velit architecto nobis id odit ullam ut ex minima earum expedita distinctio nam culpa, harum, error veniam!
		  	   </p>
		  </div>
		  <div class="block block4">
		       <h4>第四部分</h4>
		  	   <p>
		  	   	Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab ea labore, doloremque eaque veritatis consectetur distinctio ipsam, perferendis cum expedita assumenda minus! Magnam itaque dolorum dignissimos, ullam asperiores! Deleniti, rem?
		  	   	Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia porro assumenda voluptas exercitationem velit architecto nobis id odit ullam ut ex minima earum expedita distinctio nam culpa, harum, error veniam!
		  	   	Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab ea labore, doloremque eaque veritatis consectetur distinctio ipsam, perferendis cum expedita assumenda minus! Magnam itaque dolorum dignissimos, ullam asperiores! Deleniti, rem?
		  	   	Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia porro assumenda voluptas exercitationem velit architecto nobis id odit ullam ut ex minima earum expedita distinctio nam culpa, harum, error veniam!
		  	   		Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab ea labore, doloremque eaque veritatis consectetur distinctio ipsam, perferendis cum expedita assumenda minus! Magnam itaque dolorum dignissimos, ullam asperiores! Deleniti, rem?
		  	   	Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia porro assumenda voluptas exercitationem velit architecto nobis id odit ullam ut ex minima earum expedita distinctio nam culpa, harum, error veniam!
		  	   		Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab ea labore, doloremque eaque veritatis consectetur distinctio ipsam, perferendis cum expedita assumenda minus! Magnam itaque dolorum dignissimos, ullam asperiores! Deleniti, rem?
		  	   	Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia porro assumenda voluptas exercitationem velit architecto nobis id odit ullam ut ex minima earum expedita distinctio nam culpa, harum, error veniam!
		  	   		Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab ea labore, doloremque eaque veritatis consectetur distinctio ipsam, perferendis cum expedita assumenda minus! Magnam itaque dolorum dignissimos, ullam asperiores! Deleniti, rem?
		  	   	Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia porro assumenda voluptas exercitationem velit architecto nobis id odit ullam ut ex minima earum expedita distinctio nam culpa, harum, error veniam!
		  	   		Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab ea labore, doloremque eaque veritatis consectetur distinctio ipsam, perferendis cum expedita assumenda minus! Magnam itaque dolorum dignissimos, ullam asperiores! Deleniti, rem?
		  	   	Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia porro assumenda voluptas exercitationem velit architecto nobis id odit ullam ut ex minima earum expedita distinctio nam culpa, harum, error veniam!
		  	   </p>
		  </div>

	  </div>
	  <ul class="rightMenu">
		  	    	<li><a href="###">第一部分</a></li>
		  	    	<li><a href="###">第二部分</a></li>
		  	    	<li><a href="###">第三部分</a></li>
		  	    	<li><a href="###">第四部分</a></li>
		  </ul>
	  <script type="text/javascript" src="jquery-1.11.3.min.js"></script>
	  <script type="text/javascript">
        $(function(){
        	 $(".rightMenu").on("click","li",function(){
        	 	  // alert($(this).index())
        	 	  var index = $(this).index();
				  console.log(index);
				  var t = $(".wrap .block").eq(index).offset().top
				  $("html body").animate({
				  	  scrollTop:t
				  })
        	 })
        	 var h = $(".rightMenu").height();
            $(window).scroll(function(){
                 if($(document).scrollTop()<200){
                 	// alert("kk");
                 	$(".rightMenu").stop().animate({
                 		 height:0,
                              opacity: 0

                 	},1000)
                 }
                 else{
                 	$(".rightMenu").show().stop().animate({
                 		      height:h,
                              opacity: 1

                 	},1000)
                 }
            })

        })
	  </script>
</body>
</html>

  注:还需导入jQuery的插件

时间: 2024-11-04 23:52:09

jQuery的几种简单实用效果的相关文章

一种简单实用的全屏方法

实现程序全屏幕显示的思路有很多种,最常见的一种就是: 1)利用Windows API提供的一个结构体WINDOWPLACEMENT来存储全屏显示前视图和主框架窗口在屏幕上的位置和显示信息.非客户区窗口的显隐信息,以便全屏幕显示时恢复窗口原状: 2)通过API函数GetDesktopWindow()得到桌面窗口,由GetWindowRect()得到显示器的尺寸: 3)通过AdjustWindowRect()来计算当客户区大小为屏幕大小时相应的窗口大小: 4)通过SetWindowPlacement

jquery.validate.js【简单实用的表单验证框架】【进阶版】

这个是这个插件的官网和我找到的一个中文博客.(虽然插件的名字叫做jquery.validte.js,但其实,这个插件的名字叫jquery validation). 基础的用法可以去看冷子欲的文章或者上面的博客,我这里就不详细介绍了. 首先最重要的一点,所有要验证的域都要在form里,同时这些域都要有name属性. 详细内容请见原文链接:http://www.gbtags.com/gb/share/5765.htm 1. 默认validate参数的初始化: 这个插件如果要用,肯定很多页面都会用到,

jquery.validate.js【简单实用的表单验证框架】

在线演示1 本地下载 原文链接:http://www.gbtags.com/gb/share/5749.htm 最近在做用户登录.注册.以及用户中心...然后之前在慕课网学的jquery.validate用得着地方了,根据自己需求进行了细节修改,重要是样式方面吧. 第一次发表这些,说得不好不要介意,开始吧.首先: $("#form").validate({ //在这里面编辑 }); 验证的时候常常需要调试,该框架内置了一个方法,如下: debug:true, //调试模式(并不会提交)

jQuery简单实用的图片标题动画效果插件

CaptionerJs是一款简单实用的jQuery图片标题动画效果插件.网上有许多图片标题插件,但是CaptionerJs可以为你创建干净整洁并且带有语义的图片标题HTML代码. CaptionerJs不使用div作为图片层,而是使用figure和figcaption元素来转换图片,使图片和图片标题有明确的语义. 你可以在书写图片代码的时候使用标准的HTML图片代码,CaptionerJs会使用title和alt属性来制作图片的标题. 效果演示:http://www.htmleaf.com/De

基于Jquery 简单实用的弹出提示框

引言: 原生的 alert 样子看起来很粗暴,网上也有一大堆相关的插件,但是基本上都是大而全,仅仅几句话可以实现的东西,可能要引入好几十k的文件,所以话了点时间自己写了个弹出效果,放到项目上去发现效果还不错,这里贴出来,做个备忘,有需要的同学可以拿去,也可以作为一个参考. 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.d

简单实用的鼠标滑过图片遮罩层动画jQuery插件

nsHover是一款简单实用的鼠标滑过图片遮罩层动画jQuery插件.该插件可以在图片或块级元素上制作鼠标滑过时的遮罩层动画效果,它可以设置遮罩层的前景色和背景色,可以制作圆形图片等,非常实用. 在线预览   源码下载 使用方法 使用该鼠标滑过插件需要引入jQuery和ns.hover.min.js文件. 1 2 <script src="js/jquery.min.js"></script> <script src="js/ns.hover.m

jQuery简单实用的轻量级进度条插件

jQMeter是一款简单实用的轻量级进度条jQuery插件,它可以显示为水平或垂直进度条,进度条加载时带有动画特效,你只需要简单的传入一些参数到jQMeter对象的构造函数中就可以完成你想要的进度条效果. 该进度条插件的构造函数中允许你定义进度条的宽度.高度.背景色.进度条颜色等等参数,通过这些参数你可以构造自己的进度条样式. 效果演示:http://www.htmleaf.com/Demo/201504131672.html 下载地址:http://www.htmleaf.com/jQuery

jQuery轻量级简单实用的图片放大镜特效

zoomtoo是一款轻量级的简单实用的jQuery图片放大镜特效插件.这个图片放大镜特效在鼠标滑过图片的时候,在原来图片区域内部将图片放大.鼠标进入和离开图片区域时都带有淡入淡出的效果. 浏览器兼容: Firefox 2+ (Win, Mac, Linux) IE7+ (Win) Chrome 6+ (Win, Mac, Linux, Android, iPhone) Safari 3.2+ (Win, Mac, iPhone) Opera 8+ (Win, Mac, Linux, Androi

调用MyFocus库,简单实现二十几种轮播效果

一.首先点击这里下载myFocus库文件,标准文件库就行了,很小仅仅1.4M. myFocus库有以下的好处: a . 文件小巧却高效强大,能够实现二十几种轮播的效果. b . 极其简单的使用,只需要调用就可以使用,下面会介绍方法. c . 灵活的设置,很多参数可以提供设置,比如不想要文字提示,设置高度为0....更多参数适用请见网站教程页面. 二.下载下来之后,解压,看到一个文件夹,如下图所示: 对此文件夹进行一下说明:a . 打开js文件夹,然后有个js文件,就是我们最开始要调用的myfoc