PHPText.Net > ÎÄÕ > ¼¼Êõ > WEB¿ª·¢
jQuery λÖú¯ÊýʵÀý½Ì³Ì2017/05/05 23:58
6ÈËÔĶÁ
jQuery λÖú¯ÊýʵÀý½Ì³ÌÏêϸ³ö´¦²Î¿¼£ºhttp: www jb51 net article 22685 htm<!DOCTYPE html PUBLIC "- W3C DTD XHTML 1 0 Transitional EN" "http: www w3 org TR xhtml1 DTD xhtml1-transition
jQuery λÖú¯ÊýʵÀý½Ì³Ì
Ïêϸ³ö´¦²Î¿¼£º.net½Ì³Ì/article/22685.htm">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="" >
<head>
<title>jQueryµÄλÖú¯Êý(offset(),innerWidth(),innerHeight(),outerWidth(),outerHeight(),scrollTop(),scrollLeft())СӦÓÃ</title>
<style type="text/css½Ì³Ì">
#divShow{width:100px;height:50px;background-color:Green;display:none;}
#divAd{width:100px;height:100px;background-color:Red;position:absolute;top:100px;left:100px;}
</style>
<script type="text/javascript½Ì³Ì" src="js/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
//ÔÚÎı¾¿òÏ·½ÏÔʾһ¸ödiv£¬ÀàËÆÈÕÀú¿Ø¼þÄÇÑù¡£
function showDiv(obj){
jQuery("#divShow").css("left",jQuery(obj).offset().left);
jQuery("#divShow").css("top",jQuery(obj).offset().top + jQuery(obj).outerHeight());
jQuery("#divShow").show();
}
jQuery(function(){
});
//¹ö¶¯Ìõ¹ö¶¯£¬Ö´ÐÐÏÂÃæµÄº¯Êý£¬ÊʺÏ×ö¸¡¶¯¹ã¸æ
jQuery(this).scroll(function(){
jQuery("#divAd").css("top",100 + jQuery(document).scrollTop());
jQuery("#divAd").css("left",100 + jQuery(document).scrollLeft());
});
</script>
</head>
<body>
<input type="text" value="ok" onclick="showDiv(this);" />
<div id="divShow">2010-03-22</div>
<div id="divAd">¸¡¶¯¹ã¸æ</div>
<div style="height:2000px;width:2000px;">ÓÃÀ´³Å³ö¹ö¶¯Ìõ</div>
</body>
</html>
¡¡