الأحد، 5 أكتوبر 2014

اضافة نسبة مئوية (%) في الشريط الجانيني بلوجر

بسم الله الرحمان الرحيم
مرحبا بكم زوار مدونة برو ريراكـ ،

الموضوع :  اضافة جميلة تعرض نسبة المئوية بين رأس المدونة وأسفلها عند تحريك الشريط الجانبي

طريقة الإضافة
اذهب الى قالب ==> تحرير html
1- ابحث عن
]]></b:skin>

وأضف بعده ( أسفله) الكود التالي :

<style>
    #scroll
    {
        display: none;
        position: fixed;
        top: 0;
        right: 20px;
        z-index: 500;
        padding: 3px 8px;
        background-color: #2187e7;
        color: #fff;
        border-radius: 3px;
    }
    #scroll:after
    {
        content:  ”;
        position: absolute;
        top: 50%;
        right: -8px;
        height: 0;
        width: 0;
        margin-top: -4px;
        border: 4px solid transparent;
        border-left-color: #2187e7;
    }
</style>
يمكنك تغير لون الإضافة الى ما يناسبك فقط قم بتغيير
background-color: #F4D03F;
        color: #000;
#F4D03F خلفية الإضافة غير الكود الى اللون الذي يناسب مدونتك
باللون #000 لون الخط 


2- ابحث عن
</head>

وأضف بعده ( أسفله) الكود التالي :
<div id='scroll'></div>

3- ابحث عن
</body>

 وأضف بعده ( أسفله) الكود التالي :
<script type='text/javascript'>
/*<![CDATA[*/
var scrollTimer = null;
$(window).scroll(function() {
var viewportHeight = $(this).height(),
scrollbarHeight = viewportHeight / $(document).height() * viewportHeight,
progress = $(this).scrollTop() / ($(document).height() - viewportHeight),
distance = progress * (viewportHeight - scrollbarHeight) + scrollbarHeight / 2 - $('#scroll').height() / 2;
$('#scroll')
.css('top', distance)
.text(' (' + Math.round(progress * 100) + '%)')
.fadeIn(100);
if (scrollTimer !== null) {
clearTimeout(scrollTimer);
}
scrollTimer = setTimeout(function() {
$('#scroll').fadeOut();
}, 1500);
});
/*]]>*/
</script>

4- أخيرا قم بالحفظ ومبروك عليك الإضافة 
السابق
التالي

0 التعاليق: