Cara Membuat Sticky Sidebar (Sidebar melayang) di Blogspot

Cara membuat Sticky sidebar ini tidak sulit, kamu cukup copy kode script di bawah ini kemudian meletakkannya di edit template HTML pada blog.

Letakkan kode di bawah ini sebelum kode </head>

<b:if cond='data:blog.isMobileRequest == &quot;false&quot;'> 
<script type='text/javascript'>
//<![CDATA[
$(function() {
if ($('#HTML6').length) {
var el = $('#HTML6');
var stickyTop = $('#HTML6').offset().top;
var stickyHeight = $('#HTML6').height();
$(window).scroll(function() {
var limit = $('#footer').offset().top - stickyHeight - 20;
var windowTop = $(window).scrollTop();
var lebar = $(window).width();
if ((stickyTop < windowTop)&&(lebar > 759)) {
el.css({
position: 'fixed',
top: 15
});
} else {
el.css('position', 'static');
}
if (limit < windowTop) {
var diff = limit - windowTop;
el.css({
top: diff
});
}
});
}
});
//]]>
</script>
<style>
#HTML6{max-width:320px}
</style>
</b:if>

Ganti #HTML6 dengan id widget yang ingin kamu buat melayang / sticky

Ganti #footer dengan id footer yang ada di blog kamu

Postingan Terkait

No comments:

Post a Comment

Formulir Kontak

Name

Email *

Message *