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
// Page Scroll | |
var sections = $('section') | |
nav = $('nav[role="navigation"]'); | |
$(window).on('scroll', function () { | |
var cur_pos = $(this).scrollTop(); | |
sections.each(function() { | |
var top = $(this).offset().top - 76 | |
bottom = top + $(this).outerHeight(); | |
if (cur_pos >= top && cur_pos <= bottom) { |
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
http://stackoverflow.com/questions/3656592/how-to-programmatically-disable-page-scrolling-with-jquery | |
http://jsbin.com/ikuma4/2/edit?html,js,output |
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
function numericValue(event) { | |
var e = event || window.event; | |
var code = e.keyCode || e.which; | |
// allow backspace, delete, tab, and all four arrows | |
var controlKeys = [8, 9, 46]; | |
var inputField = e.target || e.srcElement; | |
// IE doesn't support indexOf | |
var isControlKey = controlKeys.join(",").match(new RegExp(code)); | |
// Some browsers just don't raise events for control keys. Easy. | |
// e.g. Safari backspace. |
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
// http://stackoverflow.com/questions/14645806/get-all-attributes-of-an-element-using-jquery | |
/** | |
* Получить все атрибуты | |
*/ | |
(function(old) { | |
$.fn.attr = function() { | |
if (arguments.length === 0) { | |
if (this.length === 0) { | |
return null; |
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
http://jsfiddle.net/aN8zc/ |
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
/** | |
* Detect which transition event browser supported | |
* @returns {*} | |
*/ | |
var whichTransitionEvent = function () { | |
var t; | |
var el = document.createElement('fakeelement'); | |
var transitions = { | |
'WebkitTransition': 'webkitTransitionEnd', | |
'transition': 'transitionend', |
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
$('.banners__item').click(function () { | |
var src = $(this).find('img').attr('src'); | |
var bannerSrc = 'img/banners/big/240x400' + src.replace(/img\/banners/, ''); | |
$('.popup__wrap__img').attr('src', bannerSrc); | |
$('.popup').bPopup({ | |
speed: 300, | |
followSpeed: 200, | |
closeClass: 'popup__cross' | |
}); | |
}); |
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
// http://stackoverflow.com/questions/17068026/prevent-ios-safari-from-moving-web-page-window-so-drag-event-can-happen | |
$(window).bind( | |
'touchmove', | |
function(e) { | |
e.preventDefault(); | |
} | |
); |
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
// https://github.com/gulpjs/gulp/blob/master/docs/API.md#gulpsrcglobs-options | |
// http://stackoverflow.com/questions/23384239/excluding-files-directories-from-gulp-task | |
fonts: ['./src/fonts/**/*.*', '!./src/fonts/icons/svg/*.*'], | |
// https://github.com/gulpjs/gulp/issues/165 | |
gulp.src(['app/**', '!app/{_tmp,_tmp/**}']) | |
// http://stackoverflow.com/a/23793997/4142600 | |
['dist/*, '!dist/scripts{,/vendor.js}']. |