Skip to content

Instantly share code, notes, and snippets.

View antiden's full-sized avatar
🎯
Focusing

antiden antiden

🎯
Focusing
View GitHub Profile
@antiden
antiden / wrap_counted_rows.txt
Created February 1, 2017 12:00
Wrap counted rows in div
/*Rows items*/
if ($(window).width() < 768) {
/*Row wrap clients*/
var $lines = $('.clients'),
holder = [];
$lines.each(function (i, item) {
holder.push(item);
@antiden
antiden / responsive_video.txt
Created February 1, 2017 11:57
Responsive Video Frame
var $allVideos = $("iframe[src*='//player.vimeo.com'], iframe[src*='//www.youtube.com'], object, embed"),
$fluidEl = $(".youtube-container");
$allVideos.each(function() {
$(this)
.attr('data-aspectRatio', this.height / this.width)
.removeAttr('height')
.removeAttr('width');
});
@antiden
antiden / lazyload_unveil_matchheight.txt
Created February 1, 2017 11:56
LazyLoad Unveil with MatchHeight
$("img.lazy").unveil(200, function() {
$(this).load(function() {
this.style.opacity = 1;
if ($(window).width() > 768) {
$('.workers__item').matchHeight();
}
});
});
@antiden
antiden / dropdown_mobile_menu.txt
Created February 1, 2017 11:55
Mobile dropdown menu
if ($(window).width() <= 960) {
$(".hamburger").on('click', function(){
$(this).toggleClass('is-active');
$('#block-osnovnaanavigacia').stop().slideToggle(500);
});
} if ($(window).width() > 960) {
$(".nav a").hover(function(){
@antiden
antiden / message_autohide.txt
Created February 1, 2017 11:54
Auto hide message after N sec and click
$('.messages span').on('click', function(){
$('.messages ').fadeOut(300);
});
function explode(){
$('.messages').fadeOut(300);
}
setTimeout(explode, 5000);
@antiden
antiden / check_height_window.txt
Created February 1, 2017 11:53
Check height window and add Class in body
var div = $("div").height();
var win = $(window).height();
if ($(window).height() < 760) {
$('body').addClass('minheight');
} else {}
@antiden
antiden / scroll_top.txt
Created February 1, 2017 11:52
Scroll to top button
<a href="#" id="totop" class="innactive"><i class="demo-icon icon-up-open-big"></i></a>
$("#totop").click(function() {
$("html, body").animate({scrollTop: 0}, 1000);
return false;
});
@antiden
antiden / scroll_addclass
Created February 1, 2017 11:51
Add class if scroll To top
$(window).scroll(function() {
if ($(this).scrollTop() > 180){
$('#header').addClass("sticky animated fadeInDown");
$('#totop').removeClass('innactive').addClass('active');
} else {
$('#header').removeClass("sticky animated fadeInDown");
$('#totop').removeClass('active').addClass('innactive');
}
});
@antiden
antiden / check_width.txt
Created February 1, 2017 11:50
Check width window
if ($(window).width() <= 768) {
} if ($(window).width() > 768) {
}
@antiden
antiden / checkurlfunction.txt
Created January 9, 2017 07:11
Check Url Function
function UrlExists(url) {
var http = new XMLHttpRequest();
http.open('HEAD', url, false);
http.send();
return http.status!=404;
}
var loadNews = 1;