This file contains 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
jQuery(function($){ | |
// Floating Sharing Buttons | |
var articleScrollHandling = { | |
allow: true, | |
reallow: function() { | |
articleScrollHandling.allow = true; | |
}, | |
delay: 200 //(milliseconds) adjust to the highest acceptable value | |
}; | |
$(window).scroll(function(){ | |
if( articleScrollHandling.allow ) { | |
articleScrollHandling.allow = false; | |
setTimeout(articleScrollHandling.reallow, articleScrollHandling.delay); | |
if ( $('body').hasClass('single-post') ) { | |
var social = $('.ea-share-count-wrap.before_content'); | |
var screen = $('.site-container'); | |
var wrap = $('.site-inner .wrap'); | |
var offset = $(social).offset().top - $(window).scrollTop(); | |
var articleBottom = $('.entry-footer').offset().top - $(window).scrollTop(); | |
var articleTop = $('h1.entry-title').offset().top - $(window).scrollTop(); | |
var left = ( screen.width() - wrap.width() ) / 2 - social.width(); | |
if( offset < 100 ) { | |
$(social).addClass('fixed'); | |
$(social).css('left', left + 'px'); | |
} | |
if( articleTop > 100 || articleBottom < 200 ) { | |
$(social).removeClass('fixed'); | |
$(social).css('left', '-' + social.width() + 'px' ); | |
} | |
} | |
} | |
}); | |
}); |
This file contains 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
@media only screen and (min-width: 1350px) { | |
.ea-share-count-wrap { | |
width: 150px; | |
position: absolute; | |
left: -150px; | |
} | |
.ea-share-count-wrap.fixed { | |
position: fixed; | |
left: 30px; | |
} | |
.ea-share-count-button.style-fancy { | |
margin: 0 0 16px; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment