1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/qietuwang-jquery_zoomload

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
В этом репозитории не указан файл с открытой лицензией (LICENSE). При использовании обратитесь к конкретному описанию проекта и его зависимостям в коде.
Клонировать/Скачать
jquery.zoomload.js 2.2 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
qietuwang Отправлено 18.01.2015 15:45 2d6b03d
/*
* jQuery.ZoomLoad.js - jQuery plugin for zoom loading images
*
* Copyright (c) 2007-2015 Qietu inc
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
* Project home:
* http://www.qietu.com/p/jquery_zoomload
*
* Version: 1.0.0
*
*/
(function($){
$.fn.zoomload = function(){
var obj = $(this);
var w = obj.width();
var h = obj.height();
var l = obj.css('margin-left') == 'auto' ? 0 : parseInt(obj.css('margin-left'));
var r = obj.css('margin-right') == 'auto' ? 0 : parseInt(obj.css('margin-right'));
var t = obj.css('margin-top') == 'auto' ? 0 : parseInt(obj.css('margin-top'));
var b = obj.css('margin-bottom') == 'auto' ? 0 : parseInt(obj.css('margin-bottom'));
obj.each(function(){
var top=$(window).scrollTop();
$(this).each(function(){
$(this).wrap('<div class="zoomload" style="width:'+ w +'px; height:'+ h +'px;"></div>');
if($(this).offset().top >= top){
$(this).css({'opacity':0, 'width':1, 'height':1,'margin-left':'+='+w/2, 'margin-top':'+='+h/2});
}
else{
$(this).addClass('animated');
}
})
});
/*var init = function(){
alert(3);
obj.each(function(){
alert(4);
})
}
init();*/
function update(){
var top=$(window).scrollTop();
var i = 0;
obj.each(function(){
//n = $(this).index();
//console.log($(this).offset().top);
if(!$(this).is(':animated') && !$(this).hasClass('animated')){
if ($(this).offset().top -top< $(window).height()){
i++;
//console.log(222);
$(this).addClass('animated').delay(i*200).animate({'opacity':1,'width':w+20, 'height':h+20, 'margin-left': l-10, 'margin-top': t-10}, 500 ,function(){
$(this).stop().animate({'width':w, 'height':h,'margin-left': l, 'margin-top': t},500); });
};
}
})
}
$(window).bind('scroll', update).resize(update);
update();
}
})(jQuery);

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/qietuwang-jquery_zoomload.git
git@api.gitlife.ru:oschina-mirror/qietuwang-jquery_zoomload.git
oschina-mirror
qietuwang-jquery_zoomload
qietuwang-jquery_zoomload
master