您的位置:首页 > 编程语言

将自己写的代码进行闭包封装

2016-09-03 12:10 281 查看
引用Zepto时,为防止$与jQuery或其他JS库的$冲突,对Zepto中的$进行闭包

<script src="js/zepto.min.js"></script>
<script type="text/javascript">
$(function($){
var clientWidth=$(window).width();
var clientHeight=$(window).height();
$('.inner').css({'width': clientWidth, 'height': clientHeight + 'px'});

var swiper = new Swiper('.swiper-container', {
direction: 'vertical',
resistanceRatio:0
});
})(zepto);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: