masonry
This commit is contained in:
@@ -1,59 +1,63 @@
|
||||
var isTouch = window.DocumentTouch && document instanceof DocumentTouch;
|
||||
var $cards = $('#items .full-works');
|
||||
var $card = $('#items .card');
|
||||
var $cat = $('.cat-list .cat a');
|
||||
|
||||
function scrollHeader() {
|
||||
// Has scrolled class on header
|
||||
var zvalue = $(document).scrollTop();
|
||||
if ( zvalue > 75 )
|
||||
$("#header").addClass("scrolled");
|
||||
else
|
||||
$("#header").removeClass("scrolled");
|
||||
function masonry() {
|
||||
var $grid = $cards.masonry({
|
||||
itemSelector: '.card',
|
||||
columnWidth: '.card',
|
||||
percentPosition: true,
|
||||
transitionDuration: '0.2s'
|
||||
});
|
||||
|
||||
$grid.imagesLoaded().progress( function() {
|
||||
$grid.masonry();
|
||||
});
|
||||
}
|
||||
|
||||
function parallaxBackground() {
|
||||
$('.parallax').css('background-positionY', ($(window).scrollTop() * 0.3) + 'px');
|
||||
function isotype() {
|
||||
var $grid = $cards.isotope({
|
||||
itemSelector: '.card',
|
||||
layoutMode: 'fitRows'
|
||||
});
|
||||
|
||||
$cat.on( 'click', function(e) {
|
||||
e.preventDefault();
|
||||
var filterValue = $( this ).attr('data-filter');
|
||||
filterValue = filterFns[ filterValue ] || filterValue;
|
||||
$grid.isotope({ filter: filterValue });
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
jQuery(document).ready(function($){
|
||||
function card(){
|
||||
var $item = $('.card')
|
||||
console.log($item);
|
||||
}
|
||||
|
||||
scrollHeader();
|
||||
function ajax() {
|
||||
var form = $('#ajax-test-form');
|
||||
form.submit(function(e) {
|
||||
// prevent form submission
|
||||
e.preventDefault();
|
||||
|
||||
// Scroll Events
|
||||
if (!isTouch){
|
||||
$(document).scroll(function() {
|
||||
scrollHeader();
|
||||
parallaxBackground();
|
||||
// submit the form via Ajax
|
||||
$.ajax({
|
||||
url: form.attr('action'),
|
||||
type: form.attr('method'),
|
||||
dataType: 'html',
|
||||
data: form.serialize(),
|
||||
success: function(result) {
|
||||
// Inject the result in the HTML
|
||||
$('#form-result').html(result);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// Touch scroll
|
||||
$(document).on({
|
||||
'touchmove': function(e) {
|
||||
scrollHeader(); // Replace this with your code.
|
||||
}
|
||||
});
|
||||
|
||||
//Smooth scroll to start
|
||||
$('#to-start').click(function(){
|
||||
var start_y = $('#start').position().top;
|
||||
var header_offset = 45;
|
||||
window.scroll({ top: start_y - header_offset, left: 0, behavior: 'smooth' });
|
||||
return false;
|
||||
});
|
||||
|
||||
//Smooth scroll to top
|
||||
$('#to-top').click(function(){
|
||||
window.scroll({ top: 0, left: 0, behavior: 'smooth' });
|
||||
return false;
|
||||
});
|
||||
|
||||
// Responsive Menu
|
||||
$('#toggle').click(function () {
|
||||
$(this).toggleClass('active');
|
||||
$('#overlay').toggleClass('open');
|
||||
$('body').toggleClass('mobile-nav-open');
|
||||
});
|
||||
|
||||
// Tree Menu
|
||||
$(".tree").treemenu({delay:300});
|
||||
|
||||
}
|
||||
jQuery(document).ready(function($){
|
||||
masonry();
|
||||
// card();
|
||||
// ajax();
|
||||
// isotype();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user