Last active
December 18, 2015 15:29
-
-
Save anandkumar/5804994 to your computer and use it in GitHub Desktop.
Genesis Sticky Social Sharebar (v2.0) (includes tweet, fb like, G+ and buffer buttons. Tutorial link: http://www.blogsynthesis.com/?p=1090) I have just updated the code for the old tutorial. Now it supports Genesis 2.0 and Responsive design. Follow the tutorial for easy installation to your Genesis based Wordpress sites.
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
<?php | |
//* Do NOT include the opening php tag and | |
//* Must read the tutorial at http://www.blogsynthesis.com/?p=1090 | |
//* Add Sharebar to Posts | |
add_action('genesis_entry_content', 'include_share_box', 3 ); | |
function include_share_box() { | |
if ( is_single() ) | |
require(CHILD_DIR.'/sharebar.php'); | |
} |
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
// Share bar | |
if ($('body').hasClass('single')) { | |
var timeout = null; var entryShare = $('#social-widgets').first(); var entryContent =$('.entry-content').first(); | |
$(window).scroll(function () { | |
var scrollTop = $(this).scrollTop(); | |
if(!timeout) { | |
timeout = setTimeout(function() { timeout = null; | |
if (entryShare.css('position') !== 'fixed' && entryShare.offset().top < $(document).scrollTop()) { | |
entryContent.css('padding-top', entryShare.outerHeight() + 8); | |
entryShare.css({'z-index': 500, 'position': 'fixed', 'top': 0, 'width': entryContent.width()}); | |
} else if ($(document).scrollTop() <= entryContent.offset().top) { | |
entryContent.css('padding-top', ''); | |
entryShare.css({ 'position': '', 'z-index': '', 'width': ''}); | |
} | |
}, 250); | |
} | |
}); | |
} |
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
/* Share bar CSS | |
------------------------------------------------------------ */ | |
.social-widgets { | |
background: #f5f5f5; | |
padding: 4px; | |
margin-bottom: 16px; | |
margin-bottom: 1.6em; | |
height: 32px; | |
overflow: hidden; | |
} | |
.social-btn { | |
height: 28px; | |
vertical-align: middle; | |
min-width: 92px; | |
display: inline-block; | |
} | |
.social-share-txt { | |
font-weight: bold; | |
float: left; | |
margin: 0 12px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment