6 posts in this topic

Posted

Hello, im trying to make a popup appear in the center of the viewers screen when a button is clicked.

It works fine so far if you dont scroll down, but if you do, then the popup stays at the top and you never see it.

You can see what I mean here: [url="http://www.newtuts.com"]http://www.newtuts.com[/url].
(You have to click on the little red (!) icon.)

How can I fix this?

Share this post


Link to post
Share on other sites

Posted

In the popup's CSS (and the background overlay CSS), you need to set the positioning to "fixed".

e.g.


[code].popup
{
position:fixed;
}[/code]

However, this won't work in IE6/7 (which don't support the "Fixed" position value), so you'll have to use some sort of javascript, or CSS "[url="http://gadgetopia.com/post/2774"]Expression[/url]" (which are IE only, and not recommended) for that.

If you're using JQuery though, why don't you use the JQuery UI [url="http://jqueryui.com/demos/dialog/#modal"]Dialog Widget[/url], which handles all this for you?

Share this post


Link to post
Share on other sites

Posted (edited)

[quote name='Majesticmerc' post='591904648' date='Nov 28 2009, 15:07']In the popup's CSS (and the background overlay CSS), you need to set the positioning to "fixed".

e.g.


[code].popup
{
position:fixed;
}[/code]

However, this won't work in IE6/7 (which don't support the "Fixed" position value), so you'll have to use some sort of javascript, or CSS "[url="http://gadgetopia.com/post/2774"]Expression[/url]" (which are IE only, and not recommended) for that.

If you're using JQuery though, why don't you use the JQuery UI [url="http://jqueryui.com/demos/dialog/#modal"]Dialog Widget[/url], which handles all this for you?[/quote]


I had never even heard of that widget. Im trying to use it now though, and nothing is happening.

In my Jquery code, i put
[code]$(document).ready(function(){

//deadlink dialog
$(function(a[name=deadlink]) {
$("#deadlink").dialog({
bgiframe: true,
height: 140,
modal: true
});
});

});[/code]

However, nothing is happening. Edited by wvcaudill2

Share this post


Link to post
Share on other sites

Posted

nevermind, I think I got it.

Thanks!

Share this post


Link to post
Share on other sites

Posted

No problem, by the way, I think I marked one of your links as dead by accident, so I apologise :laugh:

Share this post


Link to post
Share on other sites

Posted

[quote name='Majesticmerc' post='591905662' date='Nov 28 2009, 19:40']No problem, by the way, I think I marked one of your links as dead by accident, so I apologise :laugh:[/quote]

Yeah I saw that :p No harm done.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.