sticky sidebar widget - Ash Princess Kawaii
Breaking News
Loading...
07 Oktober 2014

sticky sidebar widget

Oktober 07, 2014
tutorial freebies

Blog visitors usually do not pay attention to the content in the sidebar widget. Because visitors are usually read what is needed. How to create a widget in the sidebar while scrolling down to remain above the blog or sticky sidebar widget that attract visitors?

Put the script code above </head>

<script>
/*<![CDATA[*/bs_makeSticky("YOUR_WIDGET_ID");function bs_makeSticky(f)
{var b=document.getElementById(f);var c=document.createElement("div");
b.parentNode.insertBefore(c,b);var d=b.offsetWidth;var e=b.className+" bs_sticky";
window.addEventListener("scroll",a,false);function a(){var g=c.getBoundingClientRect();
if(g.top<0){b.className=e+" bs_sticking";b.style.width=d+"px"}else{b.className=e}}};/*]]>*/
</script>



<style>
.bs_sticking {background:#f2f2f2 !important;position:fixed !important; top:0;
z-index:9999; box-shadow:0px 10px 4px -5px rgba(0,0,0,0.3); 
margin-top: 0; position:relative\9 !important;}
</style>


 For YOUR_WIDGET_ID eg. HTML1/popularpost1, to know the widget id can be read here.

2 Comments:

  1. nice tutorial ... i really like your blog style so kawaiiiiiiiiii and cuuuuute !!!!!!!!!!!!!

    BalasHapus