This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let userLang = navigator.language || navigator.userLanguage; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function isVisibleInViewport(elem) | |
| { | |
| var y = elem.offsetTop; | |
| var height = elem.offsetHeight; | |
| while ( elem = elem.offsetParent ) | |
| y += elem.offsetTop; | |
| var maxHeight = y + height; | |
| var isVisible = ( y < ( window.pageYOffset + window.innerHeight ) ) && ( maxHeight >= window.pageYOffset ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Object.prototype.trigger = function(e) { | |
| if (e == undefined) { | |
| console.error("Param missing"); | |
| } | |
| var event = document.createEvent('HTMLEvents'); | |
| event.initEvent(e, true, false); | |
| this.dispatchEvent(event); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function addListenerMulti(el, s, fn) { | |
| s.split(' ').forEach(function(e){ | |
| el.addEventListener(e, fn, false); | |
| }); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var forEach = function (array, callback, scope) { | |
| for (var i = 0; i < array.length; i++) { | |
| callback.call(scope, i, array[i]); // passes back stuff we need | |
| } | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Object.prototype.closestByClass = function(clazz) { | |
| var el = this; | |
| while (!el.classList.contains(clazz)) { | |
| el = el.parentNode; | |
| if (!el) { | |
| return null; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(window).scroll(function() { | |
| if($(window).scrollTop() + $(window).height() == $(document).height()) { | |
| alert("bottom!"); | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $("a[href*=\\#]").click(function(event){ | |
| $('html, body').animate({ | |
| scrollTop: $( $.attr(this, 'href') ).offset().top | |
| }, 800); | |
| event.preventDefault(); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(window).on('load', function () { | |
| // image loader | |
| setInterval(loadBackgroundImages, 200); | |
| }); | |
| function loadBackgroundImages(){ | |
| var count = 0; | |
| $('[data-background-image]').each( function(){ | |
| console.debug('load '+$(this).attr('data-background-image') ); | |
| var source = $(this).attr('data-background-image'); | |
| var target = $(this).css('backgroundImage'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| section.hide { | |
| margin-top: 40px; | |
| margin-bottom: -40px; | |
| opacity: 0; | |
| filter: alpha(opacity=0); | |
| } | |
| section.show { | |
| margin-top: 0px; | |
| margin-bottom: 0px; | |
| opacity: 1; |
NewerOlder