Ask your WordPress questions! Pay money and get answers fast! (more info)

Sharebar - Stop at footer WordPress

Hello, I am trying to stop my sharebar at footer (on some resolution screens its going through footer). Here is my test page [[LINK href="http://milanchymcak.com/forum-list-for-seo"]]http://milanchymcak.com/forum-list-for-seo[[/LINK]] ..I am talking about sharebar at the left / it will not display on small screens / . Thank you

Edit: here is code of javascript that actually stop it at top

<script type="text/javascript">
(function (d){
d.createElement('aside');
d.createElement('nav');
d.createElement('article');

$(d).ready(function () {
var $share = $('#share'),
$window = $(window),
shareOffset = $share.offset().top - 10,
shareMoved = false;

$window.scroll(function () {
if ($window.scrollTop() > shareOffset) {
shareMoved = true;
$share.addClass('stayOnTop');
}
else if (shareMoved) {
$share.removeClass('stayOnTop');
}

});
});
})(document);

</script>

Answers (1)

2013-07-12

Hariprasad Vijayan answers:

Hi,

Do you want to hide the sharebar in small resolution screen while scrolling?
Change the jquery like this,

<script type="text/javascript">
(function (d){
d.createElement('aside');
d.createElement('nav');
d.createElement('article');
$(d).ready(function () {
var $share = $('#share'),
$window = $(window),
shareOffset = $share.offset().top - 10,
shareMoved = false;
var temp = $('#footer').height() + $('#share').height();
$window.scroll(function () {
if ($window.scrollTop() > shareOffset) {
shareMoved = true;
$share.addClass('stayOnTop');
}
else if($window.scrollTop() > $window.height() - temp)
{
$share.hide();
}
else if (shareMoved) {
$share.removeClass('stayOnTop');
}
});
});
})(document);
</script>

Please ask if you need further help.