zoukankan      html  css  js  c++  java
  • 定义文字样式-插件

    今天抽时间写一个定义文字样式的插件:

    <!DOCTYPE HTML>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>word</title>
    </head>
    <body>
    <div class="word">
    <p>文字插件文字插件文字插件文字插件文字插件</p><br />
    <p>文字插件文字插件文字插件文字插件文字插件</p><br />

    <p>文字插件文字插件文字插件文字插件文字插件</p><br />
    <p>文字插件文字插件文字插件文字插件文字插件</p><br />

    <p>文字插件文字插件文字插件文字插件文字插件</p><br />
    <p>文字插件文字插件文字插件文字插件文字插件</p><br />

    <p>文字插件文字插件文字插件文字插件文字插件</p><br />
    <p>文字插件文字插件文字插件文字插件文字插件</p><br />

    <p>文字插件文字插件文字插件文字插件文字插件</p><br />
    <p>文字插件文字插件文字插件文字插件文字插件</p><br />


    </div>


    <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script>
    <script type="text/javascript">
    (function($){
    $.fn.extend({
    aWords:function(word){
    var defaults={
    color:"black",
    backgroundColor:"#f2f2f2",
    paddingLeft:10
    };
    var word=$.extend(defaults,word);
    return this.each(function(obj){
    var obj=$(this);
    var o=word;
    var item=$("p",obj);
    item.hover(function(){
    $(this).css(
    {color:o.color},
    {backgroundColor:o.backgroundColor}
    );
    $(this).animate(
    {paddingLeft:o.paddingLeft},
    {queue:false,duration:300}
    )
    },function(){
    $(this).css(
    {color:""},
    {backgroundColor:""}
    );
    $(this).animate(
    {paddingLeft:"0"},
    {queue:false,duration:300}
    )
    })
    })
    }
    })
    })(jQuery);

    //调用代码
    $(document).ready(function(){
    $(".word").aWords({
    paddingLeft:"10px",
    color:"red"
    })
    })
    </script>

    </body>
    </html>

  • 相关阅读:
    Spring 学习笔记
    Hello Spring(3)ConnectionUtility
    android ndk开发
    java udp 广播及socket通讯
    android 横向滚动屏幕实现(2)
    android 基于ftp远程文件管理
    android 软键盘的弹出问题总结
    android 滚动字幕
    android 基于apache ftp server
    android 设置壁纸几种方法
  • 原文地址:https://www.cnblogs.com/fs521cw/p/5180327.html
Copyright © 2011-2022 走看看