Skip to content

Instantly share code, notes, and snippets.

View Lysindr's full-sized avatar

Alexey Lysindr

  • Ukraine
View GitHub Profile
@Lysindr
Lysindr / close-out-side.js
Created January 31, 2018 10:03
Close div on click outside
var mobileMenuClose = function(event){
if ( !$(event.target).hasClass('mobile-menu')
&& !$(event.target).parents().hasClass('mobile-menu')
&& !$(event.target).parents().hasClass('menu-button')
&& !$(event.target).hasClass('menu-button') )
{
$('section.main-menu ul.menu').removeClass('show');
}
};
@Lysindr
Lysindr / placholder.scss
Created July 19, 2017 08:36
Scss placeholder mixin
@mixin placeholder {
&::-webkit-input-placeholder {
@content;
}
&:-moz-placeholder {
@content;
}
&::-moz-placeholder {
@Lysindr
Lysindr / input-range-fill.js
Last active March 5, 2018 07:45
Add to input[type="range"] fill-lower / fill-upper background-color change option
$( '.canvas-admin input[type="range"]' ).each(function() {
var formattedValue = (this.value / this.max) * 100;
$(this).css( 'background', 'linear-gradient(to right, #70ccef 0%, #2ca5d3 '+formattedValue +'%, #fff ' + formattedValue + '%, #948787 100%)' );
$(this).on('input', function() {
formattedValue = (this.value / this.max) * 100;
console.log('value: ' + this.value);
@Lysindr
Lysindr / input-range.scss
Last active July 13, 2017 13:25
Code for styling input[type="range"] . With browsers prefix (works in Chrome, Firefox, IE11, EDGE, Safari)
$primary-color: yellow; // set your color here
input[type=range] {
-webkit-appearance: none;
width: 180px;
margin: 5.8px 0;
vertical-align: middle;
&::-webkit-slider-runnable-track {
width: 100%;
@Lysindr
Lysindr / shopify-fy-articles-url-handler
Created June 8, 2017 07:34
Shopify get article Handle/url and hide if this article not current
var currentUrlPath = window.location.pathname;
var splitUrl = currentUrlPath.split('/');
var sliceUrl = splitUrl.slice(-2);
var currentArticleUrl = sliceUrl.join('/');
var $target = '#article-' + currentUrlPath;
var b = document.getElementById(sliceUrl);
var article = $('article');
@Lysindr
Lysindr / Shopify Blog Articles Navigation (next-prev article link)
Created June 7, 2017 06:45
Shopify Blog Articles Navigation (next/prev article link)
{% assign current_found = false %}
{% assign done = false %}
{% for a in blog.articles %}
{% if current_found and done == false %}
{% assign next_article = a %}
{% assign done = true %}
{% endif %}
{% unless done %}
{% if a.id == article.id %}
{% assign current_found = true %}
function initToursTab() {
//ned be change, bad code
// var tabs = $('.main-nav-list');
// if(tabs.)
var tabItem = $('.tours-left').find('li');
var tabContent = $('#tours-section').find('.tours-content');
// var tabContentBg = tabContent.css('background-image');
var mainBg = $('.tours-right');
tabItem.each(function(i) {
.tour-locations-header {
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 10;
}
.tour-pagination {
position: relative;
<svg class="clip-svg">
<defs>
<clipPath id="polygon-clip-triangle-right" clipPathUnits="objectBoundingBox">
<polygon points="100 0, 0 0, 1 1, 1 1" />
</clipPath>
</defs>
</svg>
//css
<!-- <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100px" height="100px">
<defs>
<circle id="def-circle" style="fill:rgba(green,0.5);" cx="0" cy="0" r="45" />
</defs>
<use xlink:href="#def-circle" transform="translate(50 50)">
<animateTransform attributeName="transform"
type="scale"
additive="sum"
from="0 0"
to="10 10"