Skip to content

Instantly share code, notes, and snippets.

View khripunovpp's full-sized avatar

Pavel khripunovpp

  • Adcombo
  • Porto
View GitHub Profile
@khripunovpp
khripunovpp / window.mouseout
Created June 22, 2018 09:37
window.mouseout
var flag = true;
$(window).mouseout(function(e) {
if (e.pageY - $(window).scrollTop() < 1 && flag == true) {
doSomething();
flag = false;
}
})
@khripunovpp
khripunovpp / css
Last active February 13, 2019 08:22
IE conditional stylesheet
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
/* IE10+ CSS */
}
@supports (-ms-ime-align:auto) {
/* IE Edge 12+ CSS */
}
border: 0 transparent solid
background-clip: padding-box
border-left-width: 7px
@khripunovpp
khripunovpp / _timer
Last active April 6, 2018 07:58
_timer
var _countDown = function(elem) {
var timerTime = 5000;
var minutes = 15;
var counter = $('.counter__num');
var value = counter.text();
var date = new Date();
@khripunovpp
khripunovpp / isOnScreen
Created March 23, 2018 11:59
isOnScreen
$.fn.isOnScreen = function(shift){
if(!shift){
shift = 0;
}
var viewport = {};
viewport.top = $(window).scrollTop();
viewport.bottom = viewport.top + $(window).height();
var bounds = {};
bounds.top = this.offset().top + shift;
bounds.bottom = bounds.top + this.outerHeight() - shift;
@khripunovpp
khripunovpp / functions.php
Created November 21, 2017 18:57
WP wp_enqueue_scripts action
add_action( 'wp_enqueue_scripts', 'my_scripts_method' );
function my_scripts_method(){
wp_enqueue_style( 'style', get_stylesheet_uri(), array(), hash_file('crc32', get_stylesheet_uri()));
wp_enqueue_script('libs', get_template_directory_uri() . '/js/libs.js', array(), hash_file('crc32', get_template_directory_uri() . '/js/libs.js'), true);
wp_enqueue_script('custom', get_template_directory_uri() . '/js/common.js', array(), hash_file('crc32', get_template_directory_uri() . '/js/common.js'), true);
wp_deregister_script( 'jquery-core' );
wp_register_script( 'jquery-core', '//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js');
wp_enqueue_script( 'jquery' );
};
@khripunovpp
khripunovpp / scroll-direction
Created June 20, 2017 15:09
scroll-direction
var scrollPos = 0;
$(window).scroll(function(){
var st = $(this).scrollTop();
if (st > scrollPos){
$('#info').text('DOWN');
} else {
$('#info').text('UP');
}
scrollPos = st;
});
@khripunovpp
khripunovpp / simple-smooth-scrolling
Created June 1, 2017 11:37
simple-smooth-scrolling
$(document).ready(function(){
$(".topBar__menu a").on('click', function(event) {
if (this.hash !== "") {
event.preventDefault();
var hash = this.hash;
$('html, body').animate({
scrollTop: $(hash).offset().top
}, 800, function(){
window.location.hash = hash;
});
.slider {
display: flex;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
scroll-snap-points-x: repeat(300px);
scroll-snap-type: mandatory;
}
.slider > div {
flex-shrink: 0;
$("table.price tr").on(
"click",
function() {
if ($(this).find('a').attr('href'))
document.location.href = $(this).find('a')
.attr('href');
});