home v2 update

This commit is contained in:
Bachir Soussi Chiadmi
2015-06-09 18:03:11 +02:00
parent 8a8ed4f929
commit 73741839ca
27 changed files with 3451 additions and 1097 deletions

View File

@ -92,12 +92,12 @@
initForms();
initLayout();
initInfinitScroller();
initEvents();
initKeyboardShortcuts();
initViewmodes();
if(!_isFrontHomeV2)
initLayout();
initInfinitScroller();
initEvents();
initKeyboardShortcuts();
initViewmodes();
if(_isBreveMateriauNodePage)
$.event.trigger({ type : 'resultschanged', container : '#content>.inner-content'});
@ -282,27 +282,134 @@
}, 15000);
};
/**
* home v2
/*
__ ___
/ /_ ____ ____ ___ ___ _ _|__ \
/ __ \/ __ \/ __ `__ \/ _ \ | | / /_/ /
/ / / / /_/ / / / / / / __/ | |/ / __/
/_/ /_/\____/_/ /_/ /_/\___/ |___/____/
*/
function initHomeV2(){
console.log('initHomeV2');
$('.panel-pane.showroom .group-content', '#home-v2')
.attr('data-0', 'transform:translateX(-40em);')
.attr('data-500', 'transform:translateX(0);');
$('.panel-pane.database .group-content', '#home-v2')
.attr('data-550', 'transform:translateX(40em);')
.attr('data-900', 'transform:translateX(0em);');
// Click Menu and scroll to part of the page
$('.pane-menu-menu-home-v2 .menu li a').each(function(){
// var href = $(this).attr("href");
// var part = link.replace("/fr/", "");
// $(this).attr('href', '#' +part);
// $(this).click(function(e){
// e.preventDefault();
// var scrollTo = $('.' + part).offset().top -200;
// $("body").animate({scrollTop: scrollTo}, 2000 );
// return false;
// })
var reg = /\b([^-]+)-link/g;
var match = reg.exec($(this).attr('class'));
console.log('match', match);
$(this).attr('href', '#' +match[1]+ '-pane');
$('#'+match[1]+'-pane').attr('data-menu-offset','-80');
});
// SKROLLR effects
// showroom TXT
$('.panel-pane.showroom .group-content', '#home-v2')
.attr('data-400-center-top', 'transform:translateX(-35em);opacity:0;')
.attr('data-100-center-center', 'transform[quadratic]:translateX(0em);opacity[quadratic]:1;')
.attr('data-top-bottom', 'transform[quadratic]:translateX(10em);');
// showroom Image BGD
$('.panel-pane.showroom .field-name-field-bandeau img', '#home-v2')
.attr('data-400-bottom-top', 'transform:translateY(-20em);')
.attr('data-100-top-bottom', 'transform:translateY(5em);');
// database TXT
$('.panel-pane.bdd .group-content', '#home-v2')
.attr('data-400-center-top', 'transform:translateX(40em);opacity:0;')
.attr('data-100-center-center', 'transform[quadratic]:translateX(0em);opacity[quadratic]:1;');
// database IMG
$('.panel-pane.bdd .field-name-field-bandeau img', '#home-v2')
.attr('data-400-bottom-top', 'transform:translateX(0em);')
.attr('data-100-top-bottom', 'transform[quadratic]:translateX(-40em);');
//NEWS node news
$('.panel-pane.news .views-row', '#home-v2').each(function(i, e){
$(this)
.attr('data-anchor-target', "#news-pane")
.attr('data--'+i*100+'-bottom-top', 'opacity:0;')
.attr('data-'+i*50+'-center-center', 'opacity:1;');
});
// NEWS daily
$('.panel-pane.news-panel .panel-col-last', '#home-v2')
.attr('data-400-bottom-top', 'transform:translateX(40em);')
.attr('data-center-top', 'transform[quadratic]:translateX(0em);');
// Formations
$('.panel-pane.formations .group-content', '#home-v2')
.attr('data-50-bottom-top', 'transform:translateX(20em);opacity:0;')
.attr('data-center-top', 'transform[quadratic]:translateX(0em);opacity:1;');
// Formations
$('.panel-pane.services .group-content', '#home-v2')
.attr('data-50-bottom-top', 'transform:translateX(20em);opacity:0;')
.attr('data-center-top', 'transform[quadratic]:translateX(0em);opacity:1;');
//Publication node news
$('.panel-pane.publication .views-row', '#home-v2').each(function(i, e){
$(this)
// .attr('data-anchor-target', "#news-pane")
.attr('data--'+i*100+'-bottom-top', 'opacity:0;')
.attr('data-'+i*50+'-center-center', 'opacity:1;');
});
_skrollr = skrollr.init();
//The options (second parameter) are all optional. The values shown are the default values.
skrollr.menu.init(_skrollr, {
//skrollr will smoothly animate to the new position using `animateTo`.
animate: true,
//The easing function to use.
easing: 'outCubic',
//Multiply your data-[offset] values so they match those set in skrollr.init
scale: 2,
//How long the animation should take in ms.
duration: function(currentTop, targetTop) {
//By default, the duration is hardcoded at 500ms.
// return 500;
//But you could calculate a value based on the current scroll position (`currentTop`) and the target scroll position (`targetTop`).
return Math.abs(currentTop - targetTop)*0.8;
},
//If you pass a handleLink function you'll disable `data-menu-top` and `data-menu-offset`.
//You are in control where skrollr will scroll to. You get the clicked link as a parameter and are expected to return a number.
// handleLink: function(link) {
// return 400;//Hardcoding 400 doesn't make much sense.
// },
//By default skrollr-menu will only react to links whose href attribute contains a hash and nothing more, e.g. `href="#foo"`.
//If you enable `complexLinks`, skrollr-menu also reacts to absolute and relative URLs which have a hash part.
//The following will all work (if the user is on the correct page):
//http://example.com/currentPage/#foo
//http://example.com/currentDir/currentPage.html?foo=bar#foo
///?foo=bar#foo
complexLinks: false,
//This event is triggered right before we jump/animate to a new hash.
// change: function(newHash, newTopPosition) {
// //Do stuff
// },
//Add hash link (e.g. `#foo`) to URL or not.
updateUrl: false //defaults to `true`.
});
};
/**
* layout
*/
function initLayout(){
if(!_max_768() && !$('body').is('.home-v2')){
if(!_max_768()){
var height = $('#header').h() + $('#tasks').h();
if(!_max_480() && !_touch ){
@ -1591,17 +1698,4 @@
}
};
//HOME
//Click Menu and scroll to part of the page
$(".bdd").addClass('database');
$('.pane-menu-menu-home-v2 .menu li a').each(function(){
var link = $(this).attr("href");
var part = link.replace("/fr/", "");
$(this).attr('href', '#' +part);
$(this).click(function(){
var scrollTo = $('.' + part).offset().top -200;
$("body").animate({scrollTop: scrollTo}, 2000 );
})
});
})(jQuery);