add lazyload
This commit is contained in:
@@ -24,10 +24,11 @@ function click_link() {
|
||||
success: function(data) {
|
||||
$(data).find('#item_list').addClass(cat).insertAfter($this);
|
||||
$this.addClass('open');
|
||||
|
||||
},
|
||||
complete: function(data) {
|
||||
console.log('cat', cat);
|
||||
// animate();
|
||||
lazyload();
|
||||
click_img(e, $this, $href, url, page, cat, project_name);
|
||||
}
|
||||
});
|
||||
@@ -65,10 +66,12 @@ function click_list() {
|
||||
$('#item_list.'+cat+' .card-image.open #item').remove();
|
||||
$('#item_list.'+cat+' .card-image').removeClass('open');
|
||||
$(data).find('#item').addClass(cat).insertAfter($link_card);
|
||||
|
||||
$link_card.parent().addClass('open');
|
||||
|
||||
},
|
||||
complete: function(data) {
|
||||
lazyload();
|
||||
// animate();
|
||||
marg_item(project_name);
|
||||
},
|
||||
@@ -81,6 +84,7 @@ function click_list() {
|
||||
type : 'GET', // Le type de la requête HTTP
|
||||
dataType:'html',
|
||||
success: function(data) {
|
||||
|
||||
$(data).find('#item_list').addClass(cat).insertAfter($link_txt);
|
||||
$link_txt.addClass('open');
|
||||
|
||||
@@ -94,6 +98,7 @@ function click_list() {
|
||||
},
|
||||
complete: function(data) {
|
||||
console.log('cat', cat);
|
||||
lazyload();
|
||||
|
||||
var $link_card = $('.card > #'+project_name + ' a');
|
||||
|
||||
@@ -114,6 +119,7 @@ function click_list() {
|
||||
},
|
||||
complete: function(data) {
|
||||
// animate();
|
||||
lazyload();
|
||||
marg_item(project_name);
|
||||
},
|
||||
});
|
||||
@@ -147,12 +153,14 @@ function click_img(e, $this, $href, url, page, cat, project_name) {
|
||||
success: function(data) {
|
||||
$('#item_list.'+cat+' .card-image.open #item').remove();
|
||||
$('#item_list.'+cat+' .card-image').removeClass('open');
|
||||
|
||||
$(data).find('#item').addClass(cat).insertAfter($this);
|
||||
$this.parent().addClass('open');
|
||||
marg_item(project_name);
|
||||
anchor($href);
|
||||
},
|
||||
complete:function() {
|
||||
lazyload();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
@@ -183,10 +191,10 @@ function marg_item(project_name) {
|
||||
|
||||
var margin_right = $item_list.width() - (pos_card + $card.width());
|
||||
|
||||
console.log('$card.width()',$card.width());
|
||||
console.log('pos_card',pos_card);
|
||||
console.log('$card.width()',$card.width());
|
||||
console.log('pos_card',pos_card);
|
||||
|
||||
console.log('$item_list',$item_list.width());
|
||||
console.log('$item_list',$item_list.width());
|
||||
|
||||
$item.css('margin-left', '-'+$item_offset +'px');
|
||||
// $item.parents('.card').css('margin-right', margin_right);
|
||||
@@ -228,6 +236,20 @@ function mouseHover() {
|
||||
|
||||
};
|
||||
|
||||
function lazyload() {
|
||||
$('.lazy').Lazy({
|
||||
// your configuration goes here
|
||||
// scrollDirection: 'vertical',
|
||||
effect: "fadeIn",
|
||||
effectTime: 900,
|
||||
threshold: 0
|
||||
// visibleOnly: true,
|
||||
// onError: function(element) {
|
||||
// console.log('error loading ' + element.data('src'));
|
||||
// }
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function($){
|
||||
click_link();
|
||||
click_list();
|
||||
|
||||
Reference in New Issue
Block a user