zblog,wordpress建站源码,探路者OZHO.cn

zblog,wordpress建站源码,探路者OZHO.cn

jQuery实现智能判断固定导航条或侧边栏的方法

 <div id="divToptop" ><h1 id="BlogTitle"><a href="{$host}">{$name}</a></h1><h3 id="BlogSubTitle">{$subname} </h3> <div id="divNavBar"><ul>

            {module:navbar}

          </ul><form name="search" method="post" action=" /zb_system/cmd.php?act=search"><input type="text" name="q" size="18"  class="text"style="width:80PX;height:28px;"/> <input type="submit" value=" "

           class="avatar"  style=" background:url(http://365188.cn/zb_users/upload/2021/09/20210926210540163266154018531.png) no-repeat center ;width:35PX;height:35px; "/  class="button"/></form>

           

        </div></div> 

        


     <style>

.topfixed {

  position: fixed;

  top: 0;

  left: 0;

  width: 100%;

  z-index: 9000;

  webkit-box-shadow: 0px 4px 4px #baacc9;

  -moz-box-shadow: 0px 4px 4px #baacc9;

  box-shadow: 0px 4px 4px #baacc9;

  background-color: #ffffff; opacity: 0.6;

}


#divToptop{width:100%;  margin:0 auto;}

</style>




<script>

$(window).scroll(function(){

if($(this).scrollTop()>220){

$('#divToptop').addClass('topfixed');}

else {

$('#divToptop').removeClass('topfixed');

}});

</script>

 查看demo

上一篇:Z-Blog搜索美化

下一篇: ZBLOG评论图像鼠标放上去旋转

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

网站分类
搜索
最新留言
    文章归档