首页 > Web开发 > 详细

jQuery 黑白插件

时间:2015-06-30 19:57:50      阅读:215      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!