window.open to center of screen

后端 未结 4 744
青春惊慌失措
青春惊慌失措 2021-02-05 13:47

I am using window.open to open a popup window like so:

4条回答
  •  时光取名叫无心
    2021-02-05 14:32

    This code works perfectly:

    //Code Starts
    $(document).ready(function() {
       $('#Popup').click(function() {
         var NWin = window.open($(this).prop('href'), '', 'height=800,width=800');
         if (window.focus) 
         {
           NWin.focus();
         }
         return false;
        });
    });​
    //Code Ends
    
    
    Open in Popup window
    

提交回复
热议问题