Created
September 22, 2021 19:12
-
-
Save TeamBug99/f7027cfaa9655420a6a3996a7ddaad8d to your computer and use it in GitHub Desktop.
Basic jQuery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
last 2 child add class | |
------------------------ | |
$('ul.menu>li').slice(-2).addClass('last-elements'); | |
lenth | |
--------- | |
if ($(".active").length) { | |
$(".active").dropify(); | |
} | |
data background | |
--------------- | |
$("[data-background]").each(function () { | |
$(this).css("background-image", "url(" + e(this).attr("data-background") + ")") | |
}); | |
isotop active | |
-------------- | |
// filter items on button click | |
$('.portfolio-menu').on( 'click', 'button', function() { | |
var filterValue = $(this).attr('data-filter'); | |
$grid.isotope({ filter: filterValue }); | |
}); | |
// init Isotope | |
var $grid = $('.grid').isotope({ | |
itemSelector: '.grid-item', | |
percentPosition: true, | |
masonry: { | |
// use outer width of grid-sizer for columnWidth | |
columnWidth: '.grid-item', | |
} | |
}); | |
//for menu active class | |
$('.portfolio-menu button').on('click', function(event) { | |
$(this).siblings('.active').removeClass('active'); | |
$(this).addClass('active'); | |
event.preventDefault(); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment