Javascript work

This commit is contained in:
Stephan 2019-03-30 16:52:20 +01:00
parent 4cb89ec7af
commit 9ce65091f4
11 changed files with 995 additions and 934 deletions

View file

@ -1,15 +1,55 @@
"use strict";
'use strict';
function setup() {
console.log('\n', hippie.brand, '\n\n');
console.info('Debug information:\n\nHTML height is', htmlH, '\nBODY height is', bodyH, '\nVIEW height is', viewH);
if($('#js_tph').length && viewHover) {
console.info('\n', hippie.brand, '\n\n');
if (debugOn) {
console.log('Debug information:\n', 'HTML:', hippie.screen, 'BODY:', hippie.body);
}
if ($('#js_tph').length && viewHover) {
// $('body').prepend("<div id=\"js_tph\" class=\"layer__hover hover_full_view_change\"></div>");
$('#js_tph').addClass("hover_full_view_change");
}
}
// MODULE Scroll navigation
function HippieScroll($el) {
'use strict';
// Toggle display on scroll position
// console.log('Scroll object added');
this.check = function() {
// console.log('Scroll position checked');
hippie.screen.y = Math.min($(document).scrollTop(), document.documentElement.scrollTop);
if (hippie.screen.y > initY) {
if (!initLeft) {
$el.parent().removeClass('magic');
console.info('Initial viewport left');
}
initLeft = true;
} else {
if (initLeft) {
$el.parent().addClass('magic');
console.info('Initial viewport entered');
}
initLeft = false;
}
}
// Add events to navigation elements
$('.js_scrolltop').click(function(event) {
event.preventDefault();
$('html, body').animate({
scrollTop: 0
}, basicEase);
// console.log('Scrolled to top');
});
$('.js_scrolldown').click(function(event) {
event.preventDefault();
var pos = Math.max(hippie.screen.dh, hippie.body.h) - hippie.screen.vh;
$('html').scrollTop(pos);
// document.documentElement.scrollTop = pos;
console.info('Scrolled down to', pos);
});
}
// get document coordinates of the element
// function getCoords(elem) {
// let box = elem.getBoundingClientRect();
@ -44,7 +84,7 @@ var Utils = new Utils();
// TEST
function scrollNav() {
$('.nav a').click(function(){
$('.nav a').click(function() {
//Toggle Class
$(".active").removeClass("active");
$(this).closest('li').addClass("active");