Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have one PopUp Div after data get loaded i am increasing Size of Div to populate data
so i want it to be on middle of page after increasing size or added data

JavaScript
 function GetImgDetails(elt) {
          $('#divPop').append('<img src="Images/wait.gif" />')
        
            var winH = $(window).height(),
            winW = $(window).width();
           $("#divPop").css('top', winH / 2 - $("#divPop").height() / 2);
            $("#divPop").css('left', winW / 2 - $("#divPop").width() / 2);
          
            $("body").append('<div class="loading">');
            $("#divPop").fadeIn(800).delay(1000);
            $("#divPop").empty();
//Lets say this is my data from ajax will get my data 
$("#divPop").animate({ width: "50%", height: "50%" }, 300);//here i want to rearrange div on center of page
            for (var a = 1; a <= 100; a++) {
                $("#divPop").append(a + "            ");
                if (a % 10 == 0) {
                    $("#divPop").append("<br/>")
                }
            }
           
           
        }
Posted

1 solution

Try this
JavaScript
$('#MyDiv').dialog({
          autoOpen: false,
          width: 'auto',
          height: 'auto',
          position: ['center', 20],
          draggable:false,
          resizable: false,
          title: 'Form Preview',
          modal: true,
          show: 'fade',
          hide: 'fade',
          closeText: "",
          open: function (event, ui) {
              $('#previewContainer').html($("#abc").html());
          },
          close: function (event, ui) {
              $(this).dialog('close');
          }
      });

      $("#PreviewForm").dialog("open");

  });
 
Share this answer
 
v2
Comments
Vi(ky 10-May-14 5:25am    
use jquery dialog

http://jqueryui.com/dialog/

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900