示例:
1 <!DOCTYPE html> 2 <html> 3 <head> 4 5 <title>test page</title> 6 <script src="./jquery.js"></script> 7 <script type="text/javascript"> 8 $(function(){ 9 10 $(".L_delete_wrap").click(function(){ 11 12 var scrollTop=$(window).scrollTop(); 13 $(".L_delete_wrap").css('top',scrollTop+50+'px'); 14 15 16 }); 17 $(window).scroll(function(){ 18 var scrollTop=$(window).scrollTop(); 19 $(".L_delete_wrap").css('top',scrollTop+50+'px'); 20 }); 21 22 }); 23 </script> 24 </head> 25 26 <body> 27 <a id="tp">dsfsdfsd</a> 28 <div class="L_delete_wrap" style="display: block; position: absolute;"> 29 <div class="m_login_frame_con"> 30 <div class="m_login_frame_tit"><strong>来自网页的消息</strong><a href="javascript:;" class="m_login_frame_colse"> </a></div> 31 <p>删除后该订单将会消失,确认删除?</p> 32 <div class="btns"> 33 <a class="sure" href="javascript:void(0);">确定</a> 34 <input type="hidden" value="<?php echo $item['ordercode'];?>"> 35 <a class="cancel" href="javascript:;">取消</a> 36 </div> 37 </div> 38 <input type="hidden" id="delete_orderno"> 39 </div> 40 41 1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br> 42 1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br> 43 1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br> 44 1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br> 45 1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br> 46 1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br> 47 1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br> 48 1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br> 49 50 </body> 51 </html>