Jquery广告浮动效果小案例

导入<script src="<%=path%>/html5/js/jquery.js"></script>文件

 

<SCRIPT type="text/javascript">

$(document).ready(function(){
  var menuYloc = $("#DIVFLOAT").offset().top;
  $(window).scroll(function (){
  var offsetTop = menuYloc + $(window).scrollTop() +"px";
  $("#DIVFLOAT").animate({top : offsetTop },{ duration:100 , queue:false });
  });
});

</SCRIPT>

 

<body>                                   <!--与top的距离-->
<div style="POSITION: absolute; top:50px ; left: 100px;background-color: white; width: 50px;padding-left: 60px" id="DIVFLOAT">
<table>

<c:forEach begin="1" end="4" step="1" var="i" >
<tr>
<td>DIV广告浮动效果</td>
<td>&nbsp;&nbsp;</td>
</tr>

</c:forEach>
</table>
</div>

<div style="float:left; top:40px;left:30px;background-color:white;width:100px;">
<c:forEach begin="1" end="200" step="1" var="i" varStatus="r" >
<table>
<tr>
<td>左边参照${i }==${r.index }==${r.count }</td>
</tr>
</table>
</c:forEach>
</div>
</body>

posted @ 2014-04-05 22:50  莫名字  阅读(487)  评论(0编辑  收藏  举报