1

I am trying to add an effect to a website a one of my content boxes will pop out to a new javascript popup window.

I have this code:

$('.dialog-toolbar .popout').on('click', function(){
    javascript:void
    window.open('dialogpop.php?cmd='+cmd, toolbar=0, menubar=0, location=0, status=1, scrollars=1, resizable=1, left=0, top=0);
    return false;
});

the only problem is without width and height it comes up at the default window size. Is there a way to define it tell the popup window to size of its content?

Edit I'd like to avoid having to do something like this

$('.dialog-toolbar .popout').on('click', function(){
    $('#hiddenDiv').load('dialogpop.php?cmd='+cmd, function(){
       var dwidth = $(this).width();
       var dheight = $(this).height();
       javascript:void
       window.open('dialogpop.php?cmd='+cmd,width=dwidth, height=dheight toolbar=0, menubar=0, location=0, status=1, scrollars=1, resizable=1, left=0, top=0);
       return false;
     });
});
Snymax
  • 357
  • 4
  • 18
  • 2
    That parameter must be a string. – SLaks Feb 05 '14 at 18:10
  • 1
    possible duplicate of [onclick open window and specific size](http://stackoverflow.com/questions/2157180/onclick-open-window-and-specific-size) – Michal Brašna Feb 05 '14 at 18:10
  • thats what im trying to work around i cant get the size before it opens so how would the code be able to know what value to set the height and width to. i guess i could first load the content on the parent page in a hidden div and get the size then pass it to a variable but that sounds very ugly – Snymax Feb 05 '14 at 18:13
  • @Snymax i don't think you can get a width of the content if the content has no width setted up :) – itsme Feb 05 '14 at 21:50

0 Answers0