Skip to content

Instantly share code, notes, and snippets.

@user44
user44 / Waypoints + Animate.css
Last active August 1, 2016 16:22
CSS jQuery once animate
$(".element").waypoint(function() {
$(this).addClass("animated zoomInUp");
}, {
offset: "70%"
});
.element:nth-child(1) {
-webkit-animation-delay: 0s;
-o-animation-delay: 0s;
animation-delay: 0s;
#loader {
background: none repeat scroll 0 0 #ffffff;
bottom: 0;
height: 100%;
left: 0;
position: fixed;
right: 0;
top: 0;
width: 100%;
z-index: 9999;
//Ajax отправка форм
//documentation: http://api.jquery.com/jquery.ajax/
$("#form, #form2").submit(function(e) {
e.preventDefault();
$.ajax({
type: "POST",
url: "mail.php",
data: $(this).serialize()
}).done(function() {
alert("Спасибо за заявку!");
HTML:
<div class="wrapper">
<div class="tabs">
<span class="tab">Вкладка 1</span>
<span class="tab">Вкладка 2</span>
<span class="tab">Вкладка 3</span>
</div>
<div class="tab_content">
<div class="tab_item">Содержимое 1</div>
<div class="tab_item">Содержимое 2</div>
$(window).scroll(function() {
var st = $(this).scrollTop() /10;
$(".object").css({
"transform" : "translate3d(0px, " + st + "%, .01px)",
"-webkit-transform" : "translate3d(0px, " + st + "%, .01px)"
});
});
/* Small Devices, Tablets */
@media only screen and (max-width : 768px) {
.animated {
/*CSS transitions*/
-o-transition-property: none !important;
-moz-transition-property: none !important;
-ms-transition-property: none !important;
-webkit-transition-property: none !important;
transition-property: none !important;
/*CSS transforms*/
function heightDetect() {
$(".main_head").css("height", $(window).height());
};
heightDetect();
$(window).resize(function() {
heightDetect();
});
$(window).scroll(function(){
$('.scroll-menu').toggleClass('menu-fixed', $(this).scrollTop() > 1000);
});
@user44
user44 / gulpfile.js
Last active December 23, 2015 10:02
var gulp = require('gulp');
var browserSync = require('browser-sync').create();
var sass = require('gulp-sass');
// Сервер + отслеживание sass/html/php файлов
gulp.task('serve', ['sass'], function() {
browserSync.init({
server: "./"
});
$("#button").click(function() {
$("html, body").animate({ scrollTop: $(".section-two").height()+120 }, "slow");
return false;
});