Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Facebook like box slide out as widget in sidebar
- Loading branch information
Andre Bulatov
committed
Feb 20, 2016
1 parent
d9d239c
commit cdf7ce2
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
wp-content/themes/mag-wp/custom/facebook_like_box_slideout.php
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<div id="rtt-slideout"> | ||
<style type="text/css"> | ||
#rtt-slideout { | ||
background:#ffffff; | ||
bottom:40px; | ||
position:fixed; | ||
right:-300px; | ||
width:300px; | ||
z-index: 1; | ||
} | ||
#rtt-slideout .close { | ||
color:#222222; | ||
cursor:pointer; | ||
font-family:Arial, sans-serif; | ||
font-size:26px; | ||
font-weight: bold; | ||
line-height:1; | ||
position:absolute; | ||
right:8px; | ||
top:1px; | ||
z-index: 99; | ||
} | ||
@media(max-width:300px), (max-height:479px){ | ||
#rtt-slideout { display:none; } | ||
} | ||
</style> | ||
<div class="close">×</div> | ||
<div class="fb-page" data-href="https://www.facebook.com/EARMILK" data-width="250" data-height="432" data-small-header="false" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="true"><div class="fb-xfbml-parse-ignore"><blockquote cite="https://www.facebook.com/EARMILK"><a href="https://www.facebook.com/EARMILK">EARMILK</a></blockquote></div></div> | ||
<script type="text/javascript" async> | ||
jQuery(function($) { | ||
var hideSlideout = function(){ | ||
$('#rtt-slideout').stop(true).animate({'right':'-300px'}, 100); | ||
} | ||
$(window).scroll(function(){ | ||
var docHeight = $(document).height(), | ||
scrollTop = $(window).scrollTop(), | ||
windowHeight = $(window).height(); | ||
slideHeight = 0.4 * docHeight; | ||
if(docHeight - (scrollTop + windowHeight) < slideHeight) { | ||
$('#rtt-slideout').animate({'right': '0px'}, 300); | ||
} | ||
else if(docHeight - (scrollTop + windowHeight) > slideHeight) { | ||
hideSlideout(); | ||
} | ||
}); | ||
$('#rtt-slideout .close').on('mousedown touchstart', function(){ | ||
hideSlideout(); | ||
$('#rtt-slideout').hide(); | ||
}) | ||
}); | ||
</script> | ||
</div> |