Skip to content

Instantly share code, notes, and snippets.

View 2thecrow's full-sized avatar
🐋

Alexander Pletnev 2thecrow

🐋
View GitHub Profile
@2thecrow
2thecrow / Table with data-label
Last active August 28, 2017 15:24
Adaptive Table
<table>
<thead>
<tr>
<th>Город</th>
<th>Тариф "Эконом" ЖД/Аэро</th>
<th>Тариф "Стандарт" ЖД/Аэро</th>
</tr>
</thead>
<tbody>
<tr>
@2thecrow
2thecrow / cutting-text-line.css
Last active February 28, 2023 21:04
Css hiding for text lines
overflow: hidden; /* include for safety */
display: -webkit-box; /* setting a block element */
-webkit-box-orient: vertical; /* companion class */
-webkit-line-clamp: 1; /* number of lines */
@2thecrow
2thecrow / custom-scroll-bar.css
Last active February 28, 2023 20:54
Custom scroll bar
/* Scroll bar width */
::-webkit-scrollbar {
width: 10px;
}
/* Scroll bar track */
::-webkit-scrollbar-track {
background: #f1f1f1;
}
@2thecrow
2thecrow / change-swiperJS-control.js
Last active February 28, 2023 20:54
Swiper control to another swiper
sliderName.controller.control = anothrName;
anothrName.controller.control = sliderName;
@2thecrow
2thecrow / check-for-swiperJS.js
Last active February 28, 2023 20:53
SwiperJS launch with check
const nameOfConst = document.querySelector('.swiper-class');
if (nameOfConst) {
let someName = new Swiper(nameOfConst, {
// Optional parameters
slidesPerView: 1,
loop: true,
// If we need pagination
pagination: {
el: '.swiper-pagination',
@2thecrow
2thecrow / Scroll to top js
Last active November 30, 2020 22:18
Scroll to top
/* scroll to top */
var scrollToTopBtn = document.getElementById("scrollToTopBtn");
var rootElement = document.documentElement;
function scrollToTop() {
// Scroll to top logic
rootElement.scrollTo({
top: 0,
behavior: "smooth"
})
@2thecrow
2thecrow / play-stop_swiperJS.js
Last active February 28, 2023 20:53
Stop/Star autoplay SwiperJS on mouse events
mainPageSlider.addEventListener("mouseenter", function (e) {
myMainPageSlider.params.autoplay.disableOnInteraction = false;
myMainPageSlider.params.autoplay.delay = 5000;
myMainPageSlider.autoplay.stop();
});
mainPageSlider.addEventListener("mouseleave", function (e) {
myMainPageSlider.autoplay.start();
});
@2thecrow
2thecrow / check-box.css
Last active February 28, 2023 21:03 — forked from maxdenaro/check.css
Custom policy checkbox
/* This css is for normalizing styles. You can skip this. */
*, *:before, *:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
margin: 0;
padding: 0;
}
@2thecrow
2thecrow / custom-numeric.css
Created December 18, 2020 12:23 — forked from maxdenaro/custom-numeric.css
Custom numeric on CSS (counter-reset)
ol {
counter-reset: section;
}
li {
display: inline-block;
padding-left: 10px;
}
li::before {
@2thecrow
2thecrow / multi-swiperJS.js
Last active February 28, 2023 21:03
Many SwiperJS sliders on page
const sliders = document.querySelectorAll('.swiper-container');
sliders.forEach((el) => {
let swiper = new Swiper(el, {
slidesPerView: 3,
spaceBetween: 10,
loop: true,
pagination: {
el: el.querySelector('.swiper-pagination'),
clickable: true,