Skip to content

Instantly share code, notes, and snippets.

HTML:
<!-- slider main container -->
<div class="swiper-container">
<!-- additional required wrapper -->
<div class="swiper-wrapper">
<!-- slides -->
<div class="swiper-slide">
<div class="product">
state = {
deadline: 'May, 16, 2019',
days: '0',
hours: '0',
minutes: '0',
second: '0'
}
getTimeUntil(deadline) {
const time = Date.parse(deadline) - Date.parse(new Date());
@Alex2033
Alex2033 / asc & desc Jquery Sort
Last active February 20, 2019 21:48
Проста реализация сортировки товаров по убыванию и по уменьшению цены через data атрибуты
ul.cards__list
li.card
.card__img
img(src="img/cards/card-img.jpg", alt="Card image")
h6 Микроскоп
.card__text
p Самый нужный инструмент в исследованиях. Простой и стильный.
.card__price(data-price="5000") Цена: 5000,00р
// begin rating
.rating.rating-1
@Alex2033
Alex2033 / Less @media mixins
Created December 1, 2018 06:09
Миксины препроцессора less для разных разрешений, настраиваемых через переменные
.lg(@name, @value){
@media screen and (max-width: @break_lg){
@{name}: @value;
}
}
.lg-block(@content){
@media screen and (max-width: @break_lg){
@content();
}
@Alex2033
Alex2033 / Sandwich
Created November 30, 2018 02:33 — forked from FARCER/Sandwich
Sandwich
.sandwich
.sandwich__line.sandwich__line--top
.sandwich__line.sandwich__line--middle
.sandwich__line.sandwich__line--bottom
.sandwich {
cursor: pointer;
display: none;
height: 20px;
position: relative;
.font-face(@font-family, @file-path, @font-weight, @font-style) {
@font-face {
font-family: @font-family;
src: url('@{file-path}.eot');
src: url('@{file-path}.eot?#iefix') format('embedded-opentype'),
url('@{file-path}.woff') format('woff'),
url('@{file-path}.ttf') format('truetype');
font-weight: @font-weight;
font-style: @font-style;
}
jQuery(document).ready(function() {
var carouselWidth = 768;
var carousel = null;
if( jQuery(window).width() <= carouselWidth) {
if(carousel == null)
carousel = jQuery('.mobile__slider').bxSlider();
};
@Alex2033
Alex2033 / Simple tabs Jquery
Created October 31, 2018 19:23
Tabs Jquery
$('.tabs-list li').click(function() {
var tabName = $(this).attr('show-tab');
$(this).addClass('active').siblings().removeClass('active');
$('.tabs-content .' + tabName).addClass('active').siblings().removeClass('active');
});
@Alex2033
Alex2033 / Accordion
Created September 13, 2018 11:25
jquery
$('.accordions__button').click(function () {
$(this).toggleClass('active');
$('.accordions__item + .accordions__button').not($(this).next()).slideUp(400);
$(this).next().slideToggle(400);
});
<div class="top-menu" data-hover="hover-on-menu">
<a href="/to/your/url" data-hover="hover-on-link">Hello</a>
<script>
var touchHover = function() {
$('[data-hover]').click(function(e){
e.preventDefault();
var $this = $(this);
var onHover = $this.attr('data-hover');