English 中文(简体)
弹出位置
原标题:position the pop up

我有几个框( 超过 100 个), 将在屏幕上以不同的位置动态地创建。 点击每个框后, 我要在幻灯片中弹出细节 。

我希望它的位置能滑到每个盒子的附近。 我已经做到了, 但是,如果有些盒子靠近右侧的浏览器窗口端, 一半的弹出会隐藏在窗口中 。

我希望这些弹出式在窗口前全部显示(如优等)。

我的印章印章的印章代码;

function centerPopup(comp_id, top, left) {    
    $("#popupContact").css({
        "position": "absolute",
        "top": top + 70,
        "left": left + 223
    });
}
最佳回答

如果我正确理解您的问题, 它不是与其他框的重叠, 而是在屏幕边缘丢失了一半的框。 这听起来就像您正在使用窗口边缘来设置框的位置, 但是您没有计算框本身的宽度。 一定要将当前框的宽度除以两个, 然后从最大窗口大小中减去这个宽度 。 这将将您框的右边缘置于窗口的右侧( 如果您想象在屏幕右侧设置一个框的话 ) 。

希望我能正确解释你的问题

问题回答

如果它们出现在另一个元素下方,请尝试在弹出框的样式中添加一个更高的 z-index 。 这将允许它显示 over 其它有较低 z-index 的东西。

我需要更多代码, 或一个示例(使用jsfiddle. net) 才能真正看到到底发生了什么





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签