anim
This commit is contained in:
@@ -26,47 +26,6 @@ function masonry() {
|
||||
$grid2.imagesLoaded().progress( function() {
|
||||
$grid2.masonry();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
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 });
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function card(){
|
||||
var $item = $('.card')
|
||||
console.log($item);
|
||||
}
|
||||
|
||||
function ajax() {
|
||||
var form = $('#ajax-test-form');
|
||||
form.submit(function(e) {
|
||||
// prevent form submission
|
||||
e.preventDefault();
|
||||
|
||||
// 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);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function contact() {
|
||||
@@ -83,22 +42,90 @@ function contact() {
|
||||
})
|
||||
}
|
||||
|
||||
//
|
||||
// function transitionpage() {
|
||||
// var $a = $('a');
|
||||
// var $all = $('body *');
|
||||
//
|
||||
// $a.on('click', function() {
|
||||
// $all.css('display':'none');
|
||||
// })
|
||||
//
|
||||
// }
|
||||
function scroll() {
|
||||
// left: 37, up: 38, right: 39, down: 40,
|
||||
// spacebar: 32, pageup: 33, pagedown: 34, end: 35, home: 36
|
||||
if ($('#page-wrapper.blog').length > 0){
|
||||
|
||||
$(window).bind('mousewheel DOMMouseScroll', function(event){
|
||||
var $height = $(window).scrollTop();
|
||||
var $heightW = $(window).height();
|
||||
var wh = $heightW - $height;
|
||||
|
||||
var keys = {32: 1, 37: 1, 38: 1, 39: 1, 40: 1};
|
||||
|
||||
function preventDefault(e) {
|
||||
e = e || window.event;
|
||||
if (e.preventDefault)
|
||||
e.preventDefault();
|
||||
e.returnValue = false;
|
||||
}
|
||||
|
||||
function preventDefaultForScrollKeys(e) {
|
||||
if (keys[e.keyCode]) {
|
||||
preventDefault(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function disablescroll() {
|
||||
if (window.addEventListener) // older FF
|
||||
window.addEventListener('DOMMouseScroll', preventDefault, false);
|
||||
window.onwheel = preventDefault; // modern standard
|
||||
window.onmousewheel = document.onmousewheel = preventDefault; // older browsers, IE
|
||||
window.ontouchmove = preventDefault; // mobile
|
||||
document.ontouchmove = function(e) {
|
||||
var target = e.currentTarget;
|
||||
while(target) {
|
||||
if(checkIfElementShouldScroll(target))
|
||||
return;
|
||||
target = target.parentNode;
|
||||
}
|
||||
e.preventDefault();
|
||||
};
|
||||
document.onkeydown = preventDefaultForScrollKeys;
|
||||
}
|
||||
|
||||
function enableScroll() {
|
||||
if (window.removeEventListener)
|
||||
window.removeEventListener('DOMMouseScroll', preventDefault, false);
|
||||
window.onmousewheel = document.onmousewheel = null;
|
||||
window.onwheel = null;
|
||||
window.ontouchmove = null;
|
||||
document.onkeydown = null;
|
||||
var aTag = $("#start");
|
||||
$('html,body').animate({scrollTop: aTag.offset().top},'slow');
|
||||
}
|
||||
|
||||
if (event.originalEvent.wheelDelta > 0 || event.originalEvent.detail < 0) {
|
||||
if (wh > 0) {
|
||||
console.log('up');
|
||||
$('.blog header').removeClass('hide');
|
||||
$('.blog #start').removeClass('visible');
|
||||
// disablescroll();
|
||||
// setTimeout(enableScroll, 500);
|
||||
$('.blog #start #items').removeClass('fixed');
|
||||
}
|
||||
}else {
|
||||
if (wh > 0) {
|
||||
console.log('down');
|
||||
$('.blog header').addClass('hide');
|
||||
$('.blog #start').addClass('visible');
|
||||
disablescroll();
|
||||
setTimeout(enableScroll, 500);
|
||||
$('.blog #start #items').addClass('fixed');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
jQuery(document).ready(function($){
|
||||
masonry();
|
||||
contact();
|
||||
transitionpage();
|
||||
// card();
|
||||
// ajax();
|
||||
// isotype();
|
||||
scroll();
|
||||
$(window).load(function(){
|
||||
$('html, body').scrollTop(0);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user