This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
<body> | |
</body> | |
</html> |
This file contains 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
// Smooth scroll | |
// 1) add .smooth-scroll to button | |
// 2) set data-section="#id(of anchor)" | |
// 3) | |
(function($){ | |
$.fn.scrollingTo = function( opts ) { | |
var defaults = { | |
animationTime : 1000, | |
easing : '', |
This file contains 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
// Custom scrolling speed with jQuery | |
// Source: github.com/ByNathan/jQuery.scrollSpeed | |
// Version: 1.0.2 | |
// Fixed bugs | |
// Run in your JS file: | |
// $(function() { | |
// jQuery.scrollSpeed(step, speed); | |
// }); |
This file contains 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
//Show/hide password 1.0 | |
(function($) { | |
$.toggleShowPassword = function(options) { | |
var settings = $.extend({ | |
field: '#password', | |
control: '#toggle_show_password', | |
}, options); | |
var control = $(settings.control), | |
field = $(settings.field), |
This file contains 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
license: gpl-3.0 |
This file contains 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
if ( $(window).innerWidth() <= 980) { | |
let scrollArea = document.querySelector(".selector"); | |
scrollArea.addEventListener("touchstart", function(event) { | |
this.previousClientY = event.touches[0].clientY; | |
}); | |
scrollArea.addEventListener("touchmove", function(event) { | |
let scrollTop = this.scrollTop; |
This file contains 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.onscroll = function() { | |
let animate = document.querySelectorAll('.animate'); | |
animate.forEach(function(i, el) { | |
let itemBottom = el.offsetTop + el.offsetHeight/2; | |
let windowBottom = window.pageYOffset + window.innerHeight; | |
if( windowBottom > itemBottom ) { |
This file contains 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
const inViewport = (element) => { | |
const rect = element.getBoundingClientRect(); | |
return ( | |
rect.top >= 0 && | |
rect.left >= 0 && | |
rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && /*or $(window).height() */ | |
rect.right <= (window.innerWidth || document.documentElement.clientWidth) /*or $(window).width() */ | |
); | |
}; |
This file contains 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
open() { | |
const offset = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop; | |
document.body.style.top = (offset * -1) + 'px'; | |
document.body.classList.add('iOS-scroll-fix'); | |
} | |
close() { | |
const offset = parseInt(document.body.style.top, 10); | |
document.body.classList.remove('iOS-scroll-fix'); | |
document.body.style.top = 0; |
OlderNewer