如何在页面上给jQuery元素一个固定的位置?换句话说,jQuery元素的绝对定位

时间:2010-12-29 18:47:43

标签: jquery positioning css-position offset

<script type="text/javascript">
$(function() {

 $('a.StackedSystem').hover(function(e) {
  var html = '<div id="StackedSysteminfo">';
  html +=    '<div id="StackedSystemTxt">

    ETTER utilizes the latest technologies for our booster systems, including PLC-Based controls complete with touch-screen panel user interfaces (HMI). The base package includes the gray scale screen as shown; color screens are also available. The PLC not only provides a cleaner interface but provides additional features like automatic logging and time/date stamping of all alarms and shut-downs. 
    Great for trouble-shooting.</div>';

  html +=  '</div>';    
  $('body').append(html).children('#info').hide().fadeIn(400);
 }, function() {
  $('#StackedSysteminfo').remove();
 });
});
</script>

2 个答案:

答案 0 :(得分:1)

查看jQuery UI Position,详细说明您的问题。哪个元素?

答案 1 :(得分:0)

$('element').css({"position":"absolute","top":15,"left":10 });

在这个例子中,您将从页面顶部放置15 px元素,从页面左侧放置10px。

修改

然后,您可以将absolute更改为relative,并确保包装绝对或相对定位。