Skip to content

Instantly share code, notes, and snippets.

View souljorje's full-sized avatar
🤔

Georgiy Bukharov souljorje

🤔
  • Tbilisi, Georgia
View GitHub Profile
@souljorje
souljorje / test1.html
Last active February 16, 2017 14:00
test
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<body>
</body>
</html>
@souljorje
souljorje / smooth-scroll.js
Last active May 31, 2017 08:11
Smooth scroll
// 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 : '',
@souljorje
souljorje / jquery.scrollspeed.js
Last active May 18, 2017 09:09
Smooth wheel scrolling script
// 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);
// });
@souljorje
souljorje / bootstrap responsive menu
Created May 29, 2017 08:58
bootstrap responsive menu availible
.navbar-toggle {
display: block;
}
.navbar-header {
float: none;
}
.navbar-collapse.collapse {
display: none!important;
}
.navbar-nav {
@souljorje
souljorje / showhide.js
Created July 28, 2017 12:51
Show/hide password
//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),
@souljorje
souljorje / .block
Last active August 16, 2017 12:03
d3 animated donut chart with labels
license: gpl-3.0
@souljorje
souljorje / touch-disable.js
Last active September 13, 2017 11:24
Disable touch move for all elements except selected
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;
@souljorje
souljorje / onscroll-animate.js
Created October 6, 2017 06:30
window scroll elements animating
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 ) {
@souljorje
souljorje / inViewport.js
Last active December 27, 2017 11:17
Check if element is in viewport
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() */
);
};
@souljorje
souljorje / iOS-scroll-fix.js
Last active May 28, 2018 07:18
Fix for page scrolling issue on iOS on input focus in fixed element.
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;