jquery plug-in packaging idea finishing

Source: Internet
Author: User

<! DOCTYPE html>"en">"UTF-8"> <title> Write plug-in chestnuts </title>class="lazyimg"Src="Http://static.m1905.cn/images/vip/cnc/lazyImg.gif"Data-lazysrc="http://image11.m1905.cn/uploadfile/2015/0422/thumb_1_220_318_20150422091710455317.jpg"Width=" -"height="318"alt="The gods are here."> class="lazyimg"Src="Http://static.m1905.cn/images/vip/cnc/lazyImg.gif"Data-lazysrc="http://image11.m1905.cn/uploadfile/2015/0401/thumb_1_174_98_20150401051450832875.jpg"alt=""Width=" -"height="318"> class="lazyimg"Src="Http://static.m1905.cn/images/vip/cnc/lazyImg.gif"Data-lazysrc="http://image11.m1905.cn/uploadfile/2015/0422/thumb_1_220_318_20150422092027822146.jpg"alt=""Width=" -"height="318"></body>"Http://js.static.m1905.cn/core/jquery-edge.min.js"></script><script type="Text/javascript">(function ($) {$.FN.CHANGEIMGSRC=function (options) {varDefaults = {            "Data":"data-lazysrc",            'Border':"1px solid Red"        }; //extend is the combination of options and defaults set, in which the result of this config is actually defaults defined object, so when the value can be directly config to take to the data border such as custom properties//defaults = {//"A": 1,//"B": 2// }; //options = {//"A": 1,//"B": 3// }; //then config = {//"A": 1,//"B": 3// }          //The final customization with the options is the highest priority, defaults default second        varConfig =$.extend ({}, defaults, options); return  This. each (function () {varLAZYSRC = $ ( This). attr (Config.data); $( This). attr ('src', LAZYSRC). CSS ("Border", Config.border); })    }    $('img'). CHANGEIMGSRC ({'Data':"data-lazysrc",        'Border':'20px Solid Yellow'    });}) (jQuery);</script>

Dry front-end for two years, the first time you try to package a small plug-in, although a little late but still very excited! Up

jquery plug-in packaging idea finishing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.