如何定位弹出窗口的顶部或固定在顶部的jquery移动? [英] How to position popup at top of screen or fixed at top in jquery mobile?

查看:242
本文介绍了如何定位弹出窗口的顶部或固定在顶部的jquery移动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在jquery mobile中有一个弹出式窗口

 < div data-role =popupid =itemDetails> ; 
...
< / div>

我用编程方式打开:



$('#itemDetails')。popup('open');



在屏幕上的 x,y ,我想显示修复顶部(y = 0)的屏幕,

解决方案



/ div>

类似CSS的东西应该足够了:

  #itemDetails {
position:fixed;
top:0px;
}

如果你真的想使用jQuery,

  $('#itemDetails')。css({position:'fixed',top:'0'}); 


I have a popup in jquery mobile

<div data-role="popup"   id="itemDetails">
...
</div>

and I call programmatically to open with:

$('#itemDetails').popup('open');

, but always open centered in x,y on screen, and I want show fix to top (y=0) of screen, and fixed when I have scroll.

How I can do it?, Thanks in advance.

解决方案

Something like CSS should be enough:

#itemDetails{
  position:fixed;
  top:0px;
}

If you really want to use jQuery, then

$('#itemDetails').css({position:'fixed',top:'0'});

这篇关于如何定位弹出窗口的顶部或固定在顶部的jquery移动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆