You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

50 lines
1.8 KiB

<div class="sharing_block">
<div class="social-likes">
<div class="vkontakte" title="Поделиться ссылкой во Вконтакте"></div>
<div class="facebook" title="Поделиться ссылкой на Фейсбуке"></div>
<div class="odnoklassniki" title="Поделиться ссылкой в Одноклассниках"></div>
<div class="mailru" title="Поделиться ссылкой в Моём мире"></div>
<div class="twitter" title="Поделиться ссылкой в Твиттере"></div>
</div>
</div>
<script>
// $(function(){
// var ot = $('.sharing_block').offset().top,
// left = $('.sharing_block .social-likes').offset();
// console.log(left)
// $(window).scroll(function(event) {
// if( $(window).scrollTop() >= ot + 5 ){
// $('.sharing_block .social-likes').css({
// position: 'fixed',
// top: '5px',
// left: left + 'px'
// });//.addClass('fixed');
// } else {
// $('.sharing_block .social-likes').css('position', 'static')//.removeClass('fixed');
// }
// });
// })
$('.social-likes').on('ready.social-likes', function(event, number) {
// number is total number of shares
var $sl = $('.sharing_block .social-likes'),
ot = $('.sharing_block').offset().top,
left = $sl.offset().left;
$('.sharing_block').height($sl.outerHeight());
$(window).scroll(function(event) {
if( $(window).scrollTop() >= ot ){
$sl.css({
left: left + 'px'
}).addClass('fixed');
} else {
$sl.removeClass('fixed');
}
});
});
</script>