• 定义文字样式-插件


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

    <!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>

  • 相关阅读:
    eclipse实现热部署和热启动
    java.sql.SQLException: Incorrect string value: 'xF0x9Fx98x87<b
    Springboot 热部署中存在冲突的问题
    在执行save操作时候出现的诡异!
    富文本编辑器选择使用
    Springboot 1.5.x版本上读取自定义配置文件问题
    Springboot中静态资源和拦截器处理(踩了坑)
    表单验证——jquery validate使用说明【另一个教程】
    表单验证——jquery validate使用说明
    注册页面
  • 原文地址:https://www.cnblogs.com/fs521cw/p/5180327.html
Copyright © 2020-2023  润新知