Skip to content

Instantly share code, notes, and snippets.

@Fobiya
Last active November 25, 2019 14:21
Show Gist options
  • Save Fobiya/e6425c5df950b2fa1669d8f27c23579d to your computer and use it in GitHub Desktop.
Save Fobiya/e6425c5df950b2fa1669d8f27c23579d to your computer and use it in GitHub Desktop.
JS ADD CODE
"use strict";
header__opacity -> in header
menu transutuion
$(window).scroll(function() {
var height = $(window).scrollTop();
console.log(height);
if(height < 150 ) {
$('header').removeClass('header__opacity');
} else {
$('header').addClass('header__opacity transition');
}
});
menu transutuion
ADD HTML
jQuery(document).ready(function($){
setTimeout(function() {
jQuery(".field-registration-accept").parent().append('<label>neeeee</label>');
},30);
});
ADD HTML
// NAVIGATION MENU FOOTER
$('.footer-menu .sub-menu').parent().append('<i class="icone ion-plus"></i>');
$('.footer-menu li').click(function(){
$(this).find('.sub-menu').toggleClass('open');
$(this).find('.icone').toggleClass('ion-plus ion-minus');
});
// END NAVIGATION MENU FOOTER
$('.footer-menu .sub-menu').parent().append('<i class="ion-plus"></i>'); // на уровне родителя добавить
/ menu /
$(function() {
$('.anim-button').click(function(){
$('.box__menu').addClass('open');
});
});
$(document).mouseup(function(e) { // web document click event
var div = $(".box__menu"); // here we specify the ID of the element
if (!div.is(e.target) // if the click was not on our block
&&
div.has(e.target).length === 0) { // and not by its children
$(".box__menu").removeClass("open");
}
});
/ menu /
$('.tabs-nav>li').click(function(){
if ($(this).hasClass('active')) {
}else{
$('#tabs-nav li').removeClass('active');
$(this).addClass('active');
$('.tab-content').hide();
var activeTab = $(this).find('a').data('tab');
$('.' + activeTab).fadeIn();
$('.' + activeTab).find('.accounts_wrap').slick('refresh');
}
});
$('input[class*="check"]').click(function() {
if ($(this).val() === '') {
$(this).val("YES");
} else {
$(this).val("");
};
$( window ).resize(function() {
$( "body" ).prepend( "<div>" + $( window ).width() + "</div>" );
});
$(function() {
var $document = $(document),
$header__top = $('header .header-top'),
className = 'bacraund';
$document.scroll(function() {
$header__top.toggleClass(className, $document.scrollTop() >= 1);
});
});
//// ////
!scrollTop animation анимацион
$('a[href^="#"]').click(function() {
$("html, body").animate({
scrollTop: $($(this).attr("href")).offset().top + "px"
}, {
duration: 500,
easing: "swing"
});
return false;
});
//// ////
!scrollTop animation анимацион
//// ////
$(window).scroll(function() {
if (scroll >= 100) {
} else {
}
}
//// ////
! resize window active script
//// ////
function checkWidth() {
var windowSize = $(window).width();
if (windowSize >= 992){
}else{
}
}
// Execute on load
checkWidth();
// Bind event listener
$(window).resize(checkWidth);
//// ////
$("#mainDiv").find("p"); >P обрашение по дереву классов
//// ////
$(window).on('resize orientationChange', function(event) {
$('.center').slick('reinit'); });
///////
$('.video-js source').each( function(){$(this).attr('src', $(this).attr('src').replace('video/Intro.mp4', 'video/BG-Cycle.mp4')); })
$('.info0 h3').click(function() {
$('.info0 p').toggleClass('block');
$('.info0').toggleClass('text__bold');
});
if(document.documentElement.clientWidth > 1200) {
// тут ваш скрипт
}
$(document).ready(function() {
$("#edownload__two").click(function() {
document.getElementById("downl__two").click();
document.getElementById("downl__one").click();
});
});
// срабатывает 1 раз функция
var isEvent = false;
$( window ).on( 'resize', function() {
if ( !isEvent ) {
// this my code
isEvent = true;
setTimeout( function() {
isEvent = false;
}, 1000 );
}
} )
$(document).ready(function() {
$("[class*='feedback-form'][name=submit]").click(function() {
$(":input.error").removeClass("error"), $(".allert").remove();
var i, n = $(this),
p = n.closest("form").find("[required]"),
s = n.closest("form").find("input, textarea");
return $(p).each(function() {
if ("" == $(this).val()) {
$(this);
return $(this).addClass("error").parent(".field").append('<div class="allert"><span>Fill this field</span></span><i class="ion-alert-circled"></i></div>'), i = 1, void $(":input.error:first").focus()
}
var n = /^([a-z0-9_\.-])+@[a-z0-9-]+\.([a-z]{1,20}\.)?[a-z]{1,20}$/i;
"email" == $(this).attr("type") && (n.test($(this).val()) || ($("[name=email]").val(""), $(this).addClass("error").parent(".field").append('<div class="allert"><span>Укажите коректный e-mail</span><i class="ion-alert-circled"></i></div>'), i = 1, $(":input.error:first").focus()));
"file" == $(this).attr("type") && (n.test($(this).val()) || ($("[name=fileFF[]]").val(""), $(this).addClass("error").parent(".field").append('<div class="allert"><span>Укажите коректный e-mail</span><i class="ion-alert-circled"></i></div>'), i = 1, $(":input.error:first").focus()));
"file" == $(this).attr("type") && (n.test($(this).val()) || ($("[name=rfileFF[]]").val(""), $(this).addClass("error").parent(".field").append('<div class="allert"><span>Укажите коректный e-mail</span><i class="ion-alert-circled"></i></div>'), i = 1, $(":input.error:first").focus()));
var p = /^()[0-9+()]{1,30}/i;
"tel" == $(this).attr("type") && (p.test($(this).val()) || ($("[name=phone]").val(""), $(this).addClass("error").parent(".field").append('<div class="allert"><span>Укажите коректный номер телефона</span><i class="ion-alert-circled"></i></div>'), i = 1, $(":input.error:first").focus()))
}), 1 != i && $(document).ready(function() {
var i = $(this).closest("form");
i.find(".name").val();
"" == $(this).val() ? $.ajax({
success: function() {
},
error: function(i, n) {
alert("Возникла ошибка: " + i.responseCode)
}
}) : $.ajax({
success: $.ajax({
statusCode: {
0: function() {
}
}
}),
error: function(i, n) {
alert("Возникла ошибка: " + i.responseCode)
}
})
}), !1
})
});
@Fobiya
Copy link
Author

Fobiya commented Jan 26, 2018

('.click__1').click(function() {
$('.open_1').toggleClass('block');
$('.click__1 i').toggleClass('fa-angle-up fa-angle-down');

});
#add class and delete toggle

@Fobiya
Copy link
Author

Fobiya commented Mar 1, 2018

https://github.com/Fobiya/rellax PARALLAX Адекватный

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment