JS_自己写的JQ插件

看了<<锋利的jQuery>>之后,受益匪浅,特别是有关代码风格方面的内容.

于是想把以前写的一些JQ插件整理一下,以留备用...(里面也有一些书中的例子,我也放进去了)

其它的也会陆续添加进来~~~

 

 

 

测试插件

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jQuery objMethod</title>
<script type="text/javascript" src="../jquery-1.3.2.min.js" ></script>
<script type="text/javascript" src="jquery.objMethod.js" ></script>


</head>
<style>
body { margin:0; padding:0;}

.box { border:3px solid #69F; width:70%; margin:0 auto; margin-bottom:15px;}
.box .hd { border-bottom:1px solid #69F; background:#CCC; color:#000; font-size:12px;
 margin-bottom:10px; padding:5px;}
.box .bd { /*font-size:12px;*/ text-align:center;}

.clear { clear:both;}

</style>
<body>

<!--
<div class="box">
 <div class="hd"></div>
    <div class="bd"></div>
</div>
-->

<div class="box">
 <div class="hd">
     alterBgColor    - 设置表格交替样式及hover格式
    </div>
    <div class="bd">
 <style type="text/css">
 .even { background-color:#CFC}
 .odd { background-color:#3FF;}
 .hover { background-color:yellow;}
 .click { background-color:#ccc;}
 </style>
 <table id="alterTb">
  <tbody>
   <tr>
    <td>abc</td><td>abc</td><td>abc</td><td>abc</td><td>abc</td><td>abc</td>
   </tr>
   <tr>
    <td>abc</td><td>abc</td><td>abc</td><td>abc</td><td>abc</td><td>abc</td>
   </tr>
   <tr>
    <td>abc</td><td>abc</td><td>abc</td><td>abc</td><td>abc</td><td>abc</td>
   </tr>
  </tbody>
 </table>
    </div>
</div>

<div class="box">
 <div class="hd">waterMark       - 文本框的水印效果</div>
    <div class="bd">
     <input type="textbox" id="t1"><br />
     <input type="textbox" id="t2"><br />
     <input type="textbox" id="t3">
    </div>
</div>

 

<div class="box">
 <div class="hd">floatMenuEffect - 一个浮动菜单特效</div>
    <div class="bd" style="height:320px;">
    <style type="text/css">
 ul#floatMenu { margin:0; padding:0;position:relative;  width:102px;}
 ul#floatMenu li { height:30px; width:100px; line-height:30px; position:absolute; left:0;
   border:1px solid #ccc; text-align:center; list-style:none; overflow:hidden;
   background:#9FF; cursor:pointer;}
 ul#floatMenu li span { display:block; background-color:#9FF; height:100px;}
 </style>
    <ul id="floatMenu">
        <li>
                h1
            <span>this is h1<br />
            feajlf;j;ae<br />
            fejioa;fjaoifjeai<br />
            </span>
        </li>
            <li>h2
             <span>this is h2</span>
        </li>
            <li>h3
             <span>this is h3</span>
        </li>
            <li>h4
             <span>this is h4</span>
        </li>
            <li>h5
             <span>this is h5</span>
        </li>
            <li>h6
             <span>this is h6</span>
        </li>
            <li>h7
             <span>this is h7</span>
        </li>
            <li>h8
             <span>this is h8</span>
        </li>
            <li>h9
             <span>this is h9</span>
        </li>
    </ul>
    <div class="clear"></div>
    </div>
</div>
 
 
<div class="box">
 <div class="hd">shining - </div>
    <div class="bd">
     <img src="http://www.baidu.com/img/baidu_logo.gif" alt="" id="shimg1"/><br />
  <img src="http://www.baidu.com/img/baidu_logo.gif" alt="" id="shimg2"/><br />
  <img src="http://www.baidu.com/img/baidu_logo.gif" alt="" id="shimg3"/><br />
        <p id="shi_p">this is a p</p>
    </div>
</div>


<div class="box">
 <div class="hd">posMove - </div>
    <div class="bd">
    <style type="text/css">
     #m1,#m2 { width:30px; height:30px; border:1px solid #ccc; margin-bottom:20px; color:#ccc;}
    </style>
     <div id="m1">m1</div>     <div id="m2">m2</div>
    </div>
</div>


</body>
</html>

<script type="text/javascript">
function dw(s){ document.writeln(s + "<br />");}


$(function(){
 //alterBgColor   
 $("table").alterBgColor(); 
 
 //waterMark
 $("#t1").waterMark({text:"what"});
 $("#t2").waterMark({text:"what",colorMark:"#CCC"});
 $("#t3").waterMark({text:"what",colorMark:"blue",colorEnter:"blue"});
 
 //floatMenuEffect
 $("ul#floatMenu").floatMenuEffect({posY:20});
 
 //
 $("#shimg1").shining({state:1});
 $("#shimg2").shining({state:2});
 $("#shimg3").shining({state:3});
 $("#shi_p").shining();
 
 //
 
 $("#m1").mouseover(function(){
  var arr1 = [["l",5],["t",5]];
  $(this).posMove({speed:100,step:arr1});
 });
 $("#m2").mouseover(function(){
  $(this).quiver();
 })
 
})
</script>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值