Skip to content

Instantly share code, notes, and snippets.

Avatar
😄

zdimaz

😄
View GitHub Profile
@zdimaz
zdimaz / disabled write words to input
Last active Mar 12, 2021
disabled write words to input
View disabled write words to input
.replace(/[^0-9]/g, '');
exapmle
var val = $(this).prop("value").replace(/[^0-9]/g, '');
/**
** Input Number
**/
inputNumber: function(){
@zdimaz
zdimaz / script.plugins.js
Created May 12, 2020
jq ajax form simple
View script.plugins.js
/* ==============================================
Name function
============================================== */
if($("form").length){
$('form').submit(function(e) {
e.preventDefault();
@zdimaz
zdimaz / js
Last active Nov 11, 2019
table slinky plugin
View js
/* basic table sticky*/
.wrapp_table_sticky{
overflow: hidden;
}
.wrapp_table_sticky .inner_table_sticky{
overflow: auto;
padding: 20px 0;
margin: -20px 0;
@zdimaz
zdimaz / jq fn
Created Aug 29, 2019
parralax jq fn
View 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 / js
Created Jun 17, 2019
js accordion
View js
/**
** nextOpen
**/
accordion: function(){
var self = this;
$(".set > a").on("click", function(){
@zdimaz
zdimaz / script.core.js
Last active Sep 2, 2019
accordion plugin jq
View script.core.js
self.jqueryExtend();
/*
*
*
* Accordion
*
*/
@zdimaz
zdimaz / js
Last active Mar 16, 2020
click target (not child)
View js
Если e.target - это тот же самый элемент, что и this, вы не нажали на потомка.
$('.foobar').on('click', function(e) {
if (e.target !== this){
return;
};
alert( 'clicked the foobar' );
@zdimaz
zdimaz / ajax-simple-load-div.js
Last active Mar 18, 2019
ajax simple upload file in html from div
View ajax-simple-load-div.js
$(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 / js
Last active Dec 7, 2018
spy title on scroll
View js
// ==========================================================================
// Spy category
// ==========================================================================
if (screen.width <= 720) {
function spyCategory() {
$('.spy_category_item').each( function () {
@zdimaz
zdimaz / js
Created Sep 4, 2018
Sticky block
View js
// sticky
function asideSticky() {
// body...
var asideItem = $('.aside_navigation'),
asideItemOffset = asideItem.offset().top;
$(window).scroll(function(){
if( $(this).scrollTop() > asideItemOffset ){
asideItem.addClass('sticky');