Welcome
We've been working hard

Common js fixed layer code effect, which can be used for advertising, tags, attention, personal information

The fixed layer effect is often used in web pages. You can place advertisements, tags and attention. The code is as follows

Js code:

 if ($('#follow-us')){ var followUsPosition = $('#follow-us').offset().top; window.onscroll = function () { var nowPosition =  document.documentElement.scrollTop; if (nowPosition - followUsPosition > 0 ) { setTimeout(function () { $('#follow-us').attr('class','guanzhu gd'); },150); }else { $('#follow-us').attr('class','guanzhu'); } }; } });

html:

 <div class="guanzhu" id="follow-us"> <h2 class="title">Follow us</ h2> <ul> <li class="sina"><a href="/" target="_blank"><span>Sina Weibo</span>Yang Qing's Blog</a></li> <li class="tencent"><a href="/" target="_blank"><span>Tencent Weibo</span>Yang Qing's Blog</a></li> <li class="qq"><a href="/" target="_blank"><span>QQ No.</span>1449585010</a></li> <li class="email"><a href="/" target="_blank"><span>Email account</span> xinqidianblog@qq.com </a></li> <li class="wxgzh"><a href="/" target="_blank"><span>WeChat</span>1449585010</a></li> <li class="wx"><img src="images/wx.jpg"></li> </ul> </div>

CSS:

 .gd { width: 300px; top: 100px; z-index: 999; position: fixed; _position: absolute; _top:expression(documentElement.scrollTop + 0 + "px"); _margin-top: 100px; }

 

Like( zero ) Reward
Do not reprint without permission: New Start Blog » Common js fixed layer code effect, which can be used for advertising, tags, attention, personal information


Follow the public account "New Start Software Steward"

Get the latest network resources and cracking software!
Play with all kinds of software

comment Grab the sofa

You must log in before commenting!

 

Reward the author of the article if you think it is useful

Thank you very much for your reward, we will continue to give more high-quality content, let's create a better online world together!

Scan Alipay and reward

Scan WeChat and reward