码迷,mamicode.com
首页 > Web开发 > 详细

jQuery 黑白插件

时间:2015-06-30 19:59:20      阅读:123      评论:0      收藏:0      [点我收藏+]

标签:

1 add jQuery and plug in to the page

<script src="js/jquery.min.js"></script>

<script src="js/jQuery.BlackAndWhite.js"></script>

2 add this class to the wrapper of the image that you want make in Black and White

 <div class="bwWrapper" >

    <img src="path/to/your/image" width="image width" height="image height" / >
</div>

3 set the wrapper in this way from the css:

 .bwWrapper {

    position:relative;
    display:block;
}

4 initialize the plug in on window load (no $(document).ready()) :

 

$(window).load(function(){
    $(‘.bwWrapper‘).BlackAndWhite({
        hoverEffect : true, // default true
        // set the path to BnWWorker.js for a superfast implementation
        webworkerPath : false,
        // for the images with a fluid width and height 
        responsive:true,
        // this option works only on the modern browsers ( on IE lower than 9 it remains always 1)
        intensity:1,
        speed: { //this property could also be just speed: value for both fadeIn and fadeOut
            fadeIn: 200, // 200ms for fadeIn animations
            fadeOut: 800 // 800ms for fadeOut animations
        }
    });
});

 

jQuery 黑白插件

标签:

原文地址:http://www.cnblogs.com/jweb/p/4611171.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!