last batch of adjustements

This commit is contained in:
Bachir Soussi Chiadmi
2018-01-31 19:38:26 +01:00
parent 2600e318dd
commit fdb2b653d9
14 changed files with 600 additions and 387 deletions
+47 -49
View File
@@ -1,41 +1,21 @@
jQuery(document).ready(function($) {
//window scrolls check
// $(window).scroll(function() {
// var topOfWindow = $(window).scrollTop();
// // console.log('topOfWindow',topOfWindow);
// if (topOfWindow > 100) {
// $("#top-bar").addClass("reduced");
// }
// else {
// $("#top-bar").removeClass("reduced");
// }
// });
$(window).scroll(function() {
var topOfWindow = $(window).scrollTop();
// console.log('topOfWindow',topOfWindow);
if (topOfWindow > 100) {
$("#top-bar").addClass("reduced");
}
else {
$("#top-bar").removeClass("reduced");
}
});
// init categories content images behaviour
// console.log($(window).width());
if( $(window).width() > 600 ){
// if($('body').is('.categories')){
// // console.log('hello');
// var $diapo = $('<div id="diaporama"></div>');
// $("#categories-content")
// .before($diapo)
// .find('li.project').each(function(index, el) {
// // console.log(index);
// $(this)
// .addClass('projet-'+index)
// .hover(function (e) {
// $diapo.children().removeClass('visible');
// var c = $(this).attr('class').match('projet-[0-9]+');
// console.log("class",c[0]);
// $diapo.children('.'+c[0]).addClass('visible');
// })
// .find('.projet-img')
// .addClass('projet-'+index)
// .appendTo($diapo);
// });
// $diapo.children('.projet-img').first().addClass('visible');
// }
if( $(window).width() > 600 && $('body').is('.home')){
// init Isotope
var $grid = $('.grid').isotope({
@@ -43,28 +23,46 @@ jQuery(document).ready(function($) {
transitionDuration: '0.4s'
});
// $grid.imagesLoaded().progress(function(){
// $grid.masonry('layout');
// });
// $('.grid .grid-block')
// .hide()
// .imagesLoaded().progress( function( imgLoad, image ) {
// // get item
// // image is imagesLoaded class, not <img>, <img> is image.img
// var $item = $( image.img ).parents('.grid-block');
// // un-hide item
// $item.show();
// // isotope does its thing
// $grid.appended( $item );
// });
$grid.imagesLoaded().progress(function(){
$grid.isotope('layout');
});
// filter items on button click
$('#left-nav a, .projet-block nav.categories a').on( 'click', function(e) {
$('nav.categories a').on( 'click', function(e) {
e.preventDefault();
var filterValue = $(this).attr('data-filter');
$grid.isotope({ filter: filterValue });
if($(this).is('.active')){
location.hash = '';
}else{
var filterValue = $(this).attr('data-filter');
location.hash = encodeURIComponent( filterValue );
}
return false;
});
// init Masonry
// var $grid = $('.grid').masonry({
// itemSelector: '.grid-block',
// transitionDuration: '0.4s'
// });
//
// $grid.imagesLoaded().progress(function(){
// $grid.masonry('layout');
// });
function onHashchange() {
var hashFilter = decodeURIComponent(location.hash.replace('#', ''));
$('nav.categories a').removeClass('active');
if ( !hashFilter ) {
$grid.isotope({filter: '*'});
}else{
$('nav.categories a[data-filter='+hashFilter+']').addClass('active');
$grid.isotope({filter: '.'+hashFilter});
}
}
$(window).on( 'hashchange', onHashchange );
onHashchange();
}
});