upadted home V2

This commit is contained in:
Bachir Soussi Chiadmi
2015-06-10 15:53:49 +02:00
parent 96aef8c128
commit afd3a90538
9 changed files with 407 additions and 246 deletions

View File

@ -293,116 +293,118 @@
function initHomeV2(){
console.log('initHomeV2');
// 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');
if(!_max_480()){
$('#'+match[1]+'-pane').attr('data-menu-offset','-80');
});
/*
// 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(-43em);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
$('.panel-pane.news-panel .center-wrapper .panel-panel', '#home-v2').each(function(i, e){
$(this)
// .attr('data-anchor-target', "#news-pane")
.attr('data--'+(i+1)*150+'-bottom-top', 'transform:translateY(20em);opacity:0;')
.attr('data-100-center-center', 'transform[quadratic]:translateY(0em);opacity:1;');
});
// 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;');
});
// 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();
_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 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',
//The easing function to use.
easing: 'outCubic',
//Multiply your data-[offset] values so they match those set in skrollr.init
scale: 2,
//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;
},
//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.
// },
//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,
//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
// },
//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`.
});
//Add hash link (e.g. `#foo`) to URL or not.
updateUrl: false //defaults to `true`.
});
*/
}
};
/**