Authored by lore-w

代码检查

... ... @@ -119,7 +119,7 @@ require("./login");
}else if(string.length == 5){
$(".view-more").find("span").text(num+'w+');
}
};
}
if(data.page){
var commentPage = data.page;
... ... @@ -453,7 +453,7 @@ require("./login");
// 如果传递的options是一个字符串,则表示调用改对象的原型方法。
if (typeof option == 'string') data[option](_relatedTarget);
});
};
}
$.fn.comment = Plugin;
... ...
... ... @@ -11,7 +11,7 @@ var scrollTop;
var windowHeight=$(window).height();
var delay,returnDelay,isPlaying=false;
//翻转当前对象动画
function RevolvePic(target){
function revolvePic(target){
//延时对象
var timeHandler1,timeHandler2,timeHandler3,timeHandler4;
var Y = target.offset().top;
... ... @@ -24,8 +24,7 @@ function RevolvePic(target){
});
//当图片高度小于屏幕高度:滚动高度+屏幕高度>=图片顶端位置+图片高度的三分之二(当三分之二的图片进入屏幕范围即可开始旋转),滚动高度<空间顶端位置+控件高度的三分之二(说明向上滚动)
if ((scrollTop+windowHeight>=Y+height/3*2&&scrollTop<Y+height/3*2)//图片小于屏幕
||
if ((scrollTop+windowHeight>=Y+height/3*2&&scrollTop<Y+height/3*2) || //图片小于屏幕
//当图片高度大于屏幕时分别判断:图片顶端位置+图片高度<=滚动高度+屏幕高度(说明图片已经滚动到底)以及 图片顶端位置-50<=滚动高度(说明图片顶端接近屏幕顶端)
//以上两种判断分别对应:向上滚动、向下滚动
(height>=windowHeight&&Y-50<=scrollTop)||(height>=windowHeight&&Y+height<=scrollTop+windowHeight)) {//当图片大于屏幕时执行
... ... @@ -33,7 +32,7 @@ function RevolvePic(target){
isStayLong=true;//用户在该显示区域已经停留了足够长的时间,1S
//判断是否已经增加过了旋转样式,如果没有增加就追加
if (target.attr("RevolvePic")==undefined) {
if (target.attr("RevolvePic")===undefined) {
var eleBack = null, eleFront = null,
// 两张被翻转的图片元素
eleList = target.find(".img");
... ... @@ -81,7 +80,7 @@ function RevolvePic(target){
//页面被拉动到其他区域后
isStayLong=false;
//移出当前区域后解除对target对象的标记
if (target.attr("RevolvePic")!=undefined) {
if (target.attr("RevolvePic")!==undefined) {
target.removeAttr("RevolvePic");
}
//清除四个定时器
... ... @@ -106,7 +105,7 @@ exports.init=function(info){
delay:2000,
returnDelay:2000,
wrapClass: '.lifestyle-flip'
}
};
var opts = $.extend(defaults, info);
var targets=null;
targets=$(opts.wrapClass);
... ... @@ -124,17 +123,17 @@ if(opts.operate=="auto")
var isImagesLoaded=false;
targets.find("img:first").imagesLoaded(function(){
isImagesLoaded=true;
RevolvePic($(this).parent().parent());
revolvePic($(this).parent().parent());
});
$(window).scroll(function(){
if(isImagesLoaded===true){
scrollTop=$(document).scrollTop();
targets.each(function(index,obj){
RevolvePic($(obj));
});
};
scrollTop=$(document).scrollTop();
targets.each(function(index,obj){
revolvePic($(obj));
});
}
});
}
else if(opts.operate=="mouse")
... ...
var $=require("jquery");
require('./lazyloadImage');
;
(function(global, undefined) {
var ImgSlider = function(element, options) {
... ... @@ -81,7 +81,7 @@ require('./lazyloadImage');
$(item).appendTo(_this.$element);
//添加节点后重新计算宽度
if(_this.options.itemClass != ''){
if(_this.options.itemClass !== ''){
_this.len = _this.$element.find("li."+_this.options.itemClass).length;
}else{
_this.len = _this.$element.find("li").length;
... ... @@ -105,8 +105,8 @@ require('./lazyloadImage');
_this.$element.find("img").lazyload();
if (_this.index == _this.len-_this.options.pageNum+1) {
$(this).hide();
};
if((Math.ceil(_this.index/_this.options.pageNum))%3 == 0 && (Math.ceil((_this.index-1)/_this.options.pageNum))%3 != 0){
}
if((Math.ceil(_this.index/_this.options.pageNum))%3 === 0 && (Math.ceil((_this.index-1)/_this.options.pageNum))%3 !== 0){
_this._addDom();
}
... ... @@ -117,7 +117,7 @@ require('./lazyloadImage');
_this.prev();
if (_this.index == 1) {
$(this).hide();
};
}
});
},
... ... @@ -149,7 +149,7 @@ require('./lazyloadImage');
//resize
resize:function(){
this.width = this.$lis.width() + parseInt(this.$lis.css("margin-right"));
if(this.options.itemClass != ''){
if(this.options.itemClass !== ''){
this.len = this.$element.find("li."+this.options.itemClass).length;
}else{
this.len = this.$element.find("li").length;
... ... @@ -171,7 +171,7 @@ require('./lazyloadImage');
// 如果传递的options是一个字符串,则表示调用改对象的原型方法。
if (typeof option == 'string') data[option](_relatedTarget);
});
};
}
$.fn.imgSlider = Plugin;
... ...
... ... @@ -10,7 +10,7 @@ var $=require("jquery");
this.options = $.extend(true,this.getDefaults(),options);
}
this.init();
};
}
ImgZoom.DEFAULTS = {
isContainFather: false,
overlay: true,
... ... @@ -84,17 +84,18 @@ var $=require("jquery");
ImgZoom.prototype.photoSwitch = function(index,direction){
this.$element.find("."+this.currentObj).removeClass(this.currentObj);
var _index;
if(direction=="left"){
var _index = index - 1;
_index = index - 1;
}else{
var _index = index + 1;
_index = index + 1;
}
this.$element.find("["+this.options.imgSrcAttr+"]:eq("+_index+")").addClass(this.currentObj);
this.photoEfficiency();
};
//检测首尾状态
ImgZoom.prototype.getArrowState = function(){
if(this.$element.find('['+this.options.imgSrcAttr+']').index(this.$element.find("."+this.currentObj))==0){
if(this.$element.find('['+this.options.imgSrcAttr+']').index(this.$element.find("."+this.currentObj))===0){
this.$btnPrev.hide();
}else{
this.$btnPrev.show();
... ... @@ -172,12 +173,12 @@ var $=require("jquery");
}
return $this;
});
};
}
var old = $.fn.ImgZoom;
$.fn.ImgZoom = Plugin;
$.fn.ImgZoom.Constructor = ImgZoom;
$.fn.ImgZoom.noConflict = function () {
$.fn.ImgZoom = old;
return this;
};
}
}($);
... ...