Skip to content

Instantly share code, notes, and snippets.

View zdimaz's full-sized avatar
😄

zdimaz

😄
View GitHub Profile
@zdimaz
zdimaz / script.core.js
Last active February 15, 2019 14:02
click triger outside
$(document).on('click', function(e) {
if (!$(e.target).closest(".search-header, .search-header-dropdown").length) {
$(".search-header-dropdown").slideUp();
}
e.stopPropagation();
});
@zdimaz
zdimaz / ajax-simple-load-div.js
Last active March 18, 2019 14:37
ajax simple upload file in html from div
$(document).ready(function(){
if($("#include_header").length){
$("#include_header").load("include/header.html");
};
if($("#include_header").length){
$.get('header.html',function(response){
$('#header').html(response);
@zdimaz
zdimaz / AnchorLink
Last active April 4, 2019 09:47
Anchor link (Яскорные ссылки)
@zdimaz
zdimaz / js
Created June 17, 2019 13:28
js accordion
/**
** nextOpen
**/
accordion: function(){
var self = this;
$(".set > a").on("click", function(){
@zdimaz
zdimaz / Open block from id
Last active June 27, 2019 10:21
Открытие блока по id
====================================================================================================
<a data-id="box">
<block data-id="box">
/**
** tabs to Id
**/
<div class="gmap" id="gmap" data-gmap-type="mapBox"
data-coords='[{"lat": 55.775723, "lon": 49.196191, "title":""}]'></div>
if($('.gmap').length){
self.googleMaps();
}
@zdimaz
zdimaz / jq fn
Created August 29, 2019 20:29
parralax jq fn
$(document).ready(function(){
$('section[data-type="background"]').each(function(){
var $bgobj = $(this); // создаем объект
$(window).scroll(function() {
var ypos = -($window.scrolltop() / $bgobj.data('speed')); // вычисляем коэффициент
// присваиваем значение background-position
var coords = 'center '+ ypos + 'px';
// создаем эффект parallax scrolling
$bgobj.css({ backgroundposition: coords });
@zdimaz
zdimaz / script.core.js
Last active September 2, 2019 10:23
accordion plugin jq
self.jqueryExtend();
/*
*
*
* Accordion
*
*/
@zdimaz
zdimaz / js
Last active November 11, 2019 12:58
table slinky plugin
/* basic table sticky*/
.wrapp_table_sticky{
overflow: hidden;
}
.wrapp_table_sticky .inner_table_sticky{
overflow: auto;
padding: 20px 0;
margin: -20px 0;
@zdimaz
zdimaz / js
Last active March 16, 2020 12:43
click target (not child)
Если e.target - это тот же самый элемент, что и this, вы не нажали на потомка.
$('.foobar').on('click', function(e) {
if (e.target !== this){
return;
};
alert( 'clicked the foobar' );