This file contains 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
$('select').each(function(){ | |
var $this = $(this), | |
numberOfOptions = $(this).children('option').length; | |
$this.addClass('select-hidden'); // скрываем селект | |
$this.wrap('<div class="select"></div>'); // оборачиваем селект в див | |
$this.after('<div class="select-styled"></div>'); // после селекта добавляем класс который иммитирует сам селект | |
var $styledSelect = $this.next('div.select-styled'); // выбираем иммитирующий селект блок | |
$styledSelect.text($this.children('option').eq(0).text()); // добавляем ему текст от первого option'a |
This file contains 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
­ | |
example: | |
text­text­text­ | |
thanks http://www.quirksmode.org/oddsandends/wbr.html |
This file contains 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
text-overflow: ellipsis; | |
overflow: hidden; | |
white-space: nowrap; |
This file contains 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 isNumeric(n) { | |
return !isNaN(parseFloat(n)) && isFinite(n); | |
} |
This file contains 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
var scrollHeight = Math.max( | |
document.body.scrollHeight, document.documentElement.scrollHeight, | |
document.body.offsetHeight, document.documentElement.offsetHeight, | |
document.body.clientHeight, document.documentElement.clientHeight | |
); |
This file contains 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 scrollTo(element, to, duration) { | |
if (duration < 0) return; | |
var difference = to - element.scrollTop; | |
var perTick = difference / duration * 2; | |
setTimeout(function() { | |
element.scrollTop = element.scrollTop + perTick; | |
scrollTo(element, to, duration - 2); | |
}, 10); | |
} |
This file contains 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
// single-line solution | |
$('body').css('background-position', 'center ' + (-window.pageYOffset / 8) + 'px'); | |
// more advanced solution | |
$('.paralax').each(function() { | |
var position = (-window.pageYOffset) + $(this).offset().top | |
position = -(position / 8) | |
if (position >= ($(this).height() + $(this).height() / 2)) { |
This file contains 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
gulp.task('images-webp', function () { | |
return gulp.src('./public/assets/img/**/*.{jpg,png}') | |
.pipe(webp()) | |
.pipe(gulp.dest('./public/assets/img/')) | |
.pipe(gulp.dest('./public/assets/img/')); | |
}); | |
gulp.task('images-webp-posts', function () { | |
return gulp.src('./public/files/post/**/*.{jpg,png}') | |
.pipe(webp()) |
OlderNewer