0

I'm trying to open my chat script in a popup window using window.open function.

here is what I have;

function openWindow(url,width,height,name) 
{
    width = width ? width : 725;
    height = height ? height : 600;
    var left   = (screen.width  - width)/2;
    var top    = (screen.height - height)/2;
    var params = 'width='+width+', height='+height;
    params += ', top='+top+', left='+left;
    params += ', resizable=yes';
    name = name ? name : 'Chat';
    window.open(url,name,params);
}

and this is the ajax call to actually load the content(its triggered by a button);

function chat(id)
{
     $.ajax
           ({
                 type: "POST",
                 url: "includes/chat/process.php",
                 data: {  
                          'function': 'initiate',
                          'user-id': id
                       },
                 dataType: "json",
                 success: function(data)
                 {
                     if(data.available == true)
                        openWindow("includes/chat/chat.php");
                     else if(data.available == false)
                        alert("Not available");

                 },
            });

  }

when I run it, it loads the chat.php fine however for some reason the window puts extra top-padding into my html.

I tried everything I can imagine to remove it, but no luck. all my css files has a margin and padding "0" for both body and html elements.

2 Answers 2

2

Generally you should be able to tell where that extra padding came from if you examine the page in Console or Firebug. It breaks down all the CSS to which files it came from.

1

You can try the yahoo css to control some of the aspects properly across browser.

http://www.yahooapis.com/yui/reset/

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.