Last active
December 21, 2016 11:39
-
-
Save croosen/e08d598b955e535c317c6e11afad1453 to your computer and use it in GitHub Desktop.
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
/*---------------------------------------------------- | |
* Slider, fancy nudgy hover effect | |
/*----------------------------------------------------*/ | |
function nudgeSlider(){ | |
const $slickNext = $('.slick-next'); | |
const $slickPrev = $('.slick-prev'); | |
const $slickTrack = $('.slick-track'); | |
$slickNext.add($slickPrev).each(function(){ | |
const $this = $(this); | |
const direction = $this.attr('data-dir'); | |
$this.on({ | |
mouseenter: function () { | |
if (!$(this).hasClass('slick-disabled')) { | |
$(this).parent().find($slickTrack).addClass('pull-little-'+ direction +''); | |
} | |
}, | |
mouseleave: function () { | |
$(this).parent().find($slickTrack).removeClass('pull-little-'+ direction +''); | |
} | |
}); | |
}); | |
} | |
/* CSS */ | |
.slick-track { | |
margin-left: 0; | |
transition: margin-left 0.3s ease; | |
} | |
.pull-little-left { | |
margin-left: -100px !important; //yes we need this | |
@media (max-width: $screen-xs-max) { | |
margin-left: 0 !important; | |
} | |
} | |
.pull-little-right { | |
margin-left: 100px !important; | |
@media (max-width: $screen-xs-max) { | |
margin-left: 0 !important; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment