JQuery div floating layer to follow the page scrolling effect

  • 2020-03-30 01:40:47
  • OfStack

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<meta name="keywords" content=" rolling , The floating layer ,php,jquery" /> 
<meta name="description" content="Helloweba Demo platform, demo XHTML , CSS , jquery , PHP Cases and examples " /> 
<title>jQuery Achieve the floating layer following the page scroll effect </title> 
<link rel="stylesheet" type="text/css" href="../css/main.css" /> 
<style type="text/css"> 
.demo{width:180px; height:250px; margin:10px; border:2px solid #ccc; background:#eee; padding:10px; } 
#demo1{position:relative; margin-top:-290px;} 
#demo2{position:absolute; margin-top:156px; right:10px;} 
.demo a{text-decoration:underline; cursor:pointer} 
.demo h3{font-size:14px} 
.demo p{line-height:20px} 
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> 
<script type="text/javascript" src="jquery.cookie.js"></script> 
<script type="text/javascript" src="jquery.scroll-follow.js"></script> 
<script type="text/javascript"> 
offset: 156 
//offset: 156, 
killSwitch: "switchlink", 
onText: ' Cancel the scroll ', 
offText: ' Open the scroll ' 

<div id="demo1" class="demo"> 
<img src="pic.jpg" align="" /> 
<h3>Demo 1</h3> 
<p> Scroll the mouse wheel or drag the browser's scroll bar to see. </p> 
<div id="demo2" class="demo"> 
<img src="pic1.jpg" align="" /> 
<h3>Demo 2</h3> 
<p> You can turn on and off the follow scrolling effect of the float layer by clicking on the link below. </p> 
<p><a id="switchlink"> Start switch </a></p> 
<div id="header"> 
<div id="logo"><h1><a href="http://www.helloweba.com" title=" return helloweba Home page ">helloweba</a></h1></div> 

<div id="main"> 
<h2 class="top_title"><a href="http://www.helloweba.com/view-blog-85.html">jQuery Achieve the floating layer following the page scroll effect </a></h2> 
<div id="footer"> 
<p>Powered by helloweba.com  Permission to reprint, modify and use this site DEMO But please note the source: <a href="http://www.helloweba.com">www.helloweba.com</a></p> 
<p id="stat"><script type="text/javascript" src="http://js.tongji.linezing.com/1870888/tongji.js"></script></p> 


Related articles: