Skip to content

Instantly share code, notes, and snippets.

View pabliqe's full-sized avatar

Pablo Armentano pabliqe

View GitHub Profile
/**
* Extends Webflow Slider with public methods to swich between slides
*
* Paste this code on the Custom Code panel to get started:
*
* var slider = new W_SLIDER_CONTROLLER( '#element_id' );
* slider.setup('drag_disabled') // removes the drag-and-slide interaction
* slider.goto( 2 ); // jumps to the second slide
*/
var W_SLIDER_CONTROLLER = function( el ){
/**
* This styles are the minimal essential properties
* to get chosen working without extra styling
* that you are going to override later
*/
.chosen-container {
position: relative;
display: -moz-inline-stack;
display: inline-block;
*vertical-align: auto;
// usage smoothScrollTo.call([NodeElement])
function smoothScrollTo(completeCallback) {
// center element on screen
var posY = window.pageYOffset - (window.innerHeight / 2) + this.getBoundingClientRect().top + (this.offsetHeight / 2);
scrollAnimator = TweenLite.to(window, 1, {
scrollTo: {
y: posY
},
onComplete: function(){
@pabliqe
pabliqe / gist:50408d797e2a3425628ef56ee7f54ae5
Last active September 19, 2017 13:30
Bookmarklet to scroll a webpage automatically
javascript:(function(){
/* tired of scrolling? try this... */
var lazyScroll = setInterval(function() {
window.scrollTo(0, window.pageYOffset+1);
}, 0);
})();