add scrolltop

This commit is contained in:
2019-10-09 22:26:28 +02:00
parent 588d796db5
commit 78c3a80a65
7 changed files with 61 additions and 266 deletions
+39 -7
View File
@@ -100,7 +100,6 @@ function click_list() {
$('.card a').click(function (e) {
e.preventDefault()
})
click_img(e, $this, $href, url, page, cat, project_name)
},
complete: function(data) {
@@ -175,6 +174,7 @@ function click_img(e, $this, $href, url, page, cat, project_name) {
// $projet.prepend(hamburger);
closeAjax();
$loader.hide();
scrollTop();
}
});
@@ -198,6 +198,7 @@ function animate() {
function marg_item(project_name) {
var $item = $('.card-image#'+project_name+' #item');
var $item_offset = $item.offset().left-8;
var $card = $item.parents('.card');
@@ -206,13 +207,36 @@ 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('$item_list',$item_list.width());
$item.css('margin-left', '-'+$item_offset +'px');
// $item.parents('.card').css('margin-right', margin_right);
// if new.vignette.left != old.vignette.left
// alors recalcule margin.left
// var timer;
// $(window).resize(function() {
// if(timer) {
// window.clearTimeout(timer);
// }
//
// timer = window.setTimeout(function() {
// // actual callback
// var $item = $('.card-image#'+project_name+' #item');
// console.log($item, '$item');
// console.log( "Firing!" );
//
// var $item_offset = $item.offset().left-8;
// console.log( "$item_offset", $item_offset );
// var $card = $item.parents('.card');
//
// var $item_list = $item.parents('#item_list');
//
// var pos_card = $card.offset().left;
//
// var margin_right = $item_list.width() - (pos_card + $card.width());
// $item.css('margin-left', '-'+$item_offset +'px');
// }, 500);
//
// });
}
function mouseHover() {
@@ -302,6 +326,14 @@ function croix() {
$link.append(loader);
}
function scrollTop() {
var $body = $("html, body");
$('#item #top').click(function() {
$body.stop().animate({scrollTop:0}, 500, 'swing', function() {
});
})
}
$(document).ready(function($){
// redirection();
click_link();