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>

  • 相关阅读:
    vuex状态管理
    vue3.0创建一个项目
    Django + Vue
    Django部署
    django简单使用
    Django模型
    Centos7编译openjdk8源码
    深入了解final
    深入了解java值传递
    java自带的Logger日志系统
  • 原文地址:https://www.cnblogs.com/fs521cw/p/5180327.html
Copyright © 2011-2022 走看看