Skip to content

Instantly share code, notes, and snippets.

View zdimaz's full-sized avatar
😄

zdimaz

😄
View GitHub Profile
@zdimaz
zdimaz / The Wizard of Oz, 1939
Last active December 21, 2021 11:46
emits vue 3 js
<!--
From the child component, you want to do an "emit".
This tells the parent to run the callback specified
in the child component reference. Psuedo code:
-->
<child>
<button @click="send()">Click Me</button>
methods: {
@zdimaz
zdimaz / disabled write words to input
Last active July 28, 2021 08:41
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 08:39
jq ajax form simple
/* ==============================================
Name function
============================================== */
if($("form").length){
$('form').submit(function(e) {
e.preventDefault();
@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 / 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 / js
Created June 17, 2019 13:28
js accordion
/**
** nextOpen
**/
accordion: function(){
var self = this;
$(".set > a").on("click", function(){
@zdimaz
zdimaz / script.core.js
Last active September 2, 2019 10:23
accordion plugin jq
self.jqueryExtend();
/*
*
*
* Accordion
*
*/
@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' );
@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 / js
Last active December 7, 2018 11:04
spy title on scroll
// ==========================================================================
// Spy category
// ==========================================================================
if (screen.width <= 720) {
function spyCategory() {
$('.spy_category_item').each( function () {