console.log("hello wegrow");
jQuery(document).ready(function( $ ) {
$("div[id^='tl']").addClass("navitem");
$("#tc1-0").wrap("
"); // nav 1
$("#tabs2").wrap("
"); // nav 2
var offset1 = $("#tc1-0").offset();
var destroy1 = $("#coaching").offset(); // we've reached the end of the first sticky content area.
var offset2 = $("#tabs2").offset();
var tc1offset = $("#tc1-1").offset();
var tc2offset = $("#tc1-2").offset();
var tc3offset = $("#tc1-3").offset();
var tc4offset = $("#tc1-4").offset();
var tc5offset = $("#tc2-1").offset();
var tc6offset = $("#tc2-2").offset();
var tc7offset = $("#tc2-3").offset();
var tc8offset = $("#tc2-4").offset();
$(window).scroll(function (event) {
var scroll = $(window).scrollTop();
/*
***
* stickynav
***
*/
// Offset 1 - People Innovation
// console.log( "scroll from top:" + scroll + "px" + "\n" + "Offset1: " + offset1.top + "\n" + "Offset1Destroy" + destroy1.top );
if ( scroll >= ( offset1.top - 0 ) && ( ( scroll - 80 ) < destroy1.top ) ) {
$("#tc1-0").addClass("stickynav");
} else {
$("#tc1-0").removeClass("stickynav");
}
// Offset 2 - Coaching
//console.log( "scroll from top:" + scroll + "px" + "\n" + "Offset2: " + offset2.top );
if ( scroll >= ( offset2.top + 64 ) ) { // need adjustments
$("#tabs2").addClass("stickynav");
} else {
$("#tabs2").removeClass("stickynav");
}
/*
***
* active navitem (stickynav)
***
*/
if ( scroll >= ( tc1offset.top + 0 ) ) { // perf. + leaders
$("div[id^='tl']").removeClass("active");
$("#tl1-1").addClass("active");
}
if ( scroll >= ( tc2offset.top + 10 ) ) { // effective teams
$("div[id^='tl']").removeClass("active");
$("#tl1-2").addClass("active");
}
if ( scroll >= ( tc3offset.top + 50 ) ) { // shaping change
$("div[id^='tl']").removeClass("active");
$("#tl1-3").addClass("active");
}
if ( scroll >= ( tc4offset.top + 20 ) ) { // interim mgmt
$("div[id^='tl']").removeClass("active");
$("#tl1-4").addClass("active");
}
if ( scroll >= ( tc5offset.top - 24 ) ) { // Einzelcoaching
$("div[id^='tl']").removeClass("active");
$("#tl2-1").addClass("active");
}
if ( scroll >= ( tc6offset.top + 64 ) ) { // was ist C
$("div[id^='tl']").removeClass("active");
$("#tl2-2").addClass("active");
}
if ( scroll >= ( tc7offset.top + 90) ) { // ist C wirksam
$("div[id^='tl']").removeClass("active");
$("#tl2-3").addClass("active");
}
if ( scroll >= ( tc8offset.top + 100 ) ) { // methodischer Ansatz
$("div[id^='tl']").removeClass("active");
$("#tl2-4").addClass("active");
}
}); //window.scroll
}); // jQuery end