2
Answers

How to Zoomin from clientside

Milton Smith

Milton Smith

16y
1.7k
1

I am designing a layout for a floor. I want to include zoom in and zoom out feature  from client side.I have a div and i made position = absolute,to give my lay out proper looks. I am calling a java script function for zoomin and zoomout. If I remove the position it is Zooming but with position= absolute it is not zooming.But  in my case position= absolute is important for looks. So anybody tell me how to ZOOM in from client side when position= absolute is activated.

 

 

My java script function is as follows:

 

function zoomin(){

if(parent.parent.document.body.style.zoom!=0)

parent.parent.document.body.style.zoom*=1.2;

else

parent.parent.document.body.style.zoom=1.2;

}

 

My .cs code is as follows:

 

 

string strSQL = "SELECT bdm_txt_BuildingType, bdm_txt_Caption, bdm_num_Left, bdm_num_Top,bdm_num_Length, bdm_num_Breadth, bdm_num_FontSize FROM BuildingDimensions WHERE bdm_num_PartId = " + Session["Id"] + " ";

DataSet dstData = new DataSet();

objDataAccess.GetDataSet(ref dstData, strSQL, "Event");

for (int intIndex = 0; intIndex < dstData.Tables["Event"].Rows.Count; intIndex++)

{

dblBuildLeft = Convert.ToDouble(dstData.Tables["Event"].Rows[intIndex]["bdm_num_Left"]) * 38 * 0.0576;

dblBuildTop = Convert.ToDouble(dstData.Tables["Event"].Rows[intIndex]["bdm_num_Top"]) * 38 * 0.0576;

dblBuildTop = dblBuildTop + 45;

dblBuildWidth = Convert.ToDouble(dstData.Tables["Event"].Rows[intIndex]["bdm_num_Length"]) * 38 * 0.0576;

dblBuildHeight = Convert.ToDouble(dstData.Tables["Event"].Rows[intIndex]["bdm_num_Breadth"]) * 38 * 0.0576;

strCaption = dstData.Tables["Event"].Rows[intIndex]["bdm_txt_Caption"].ToString();

hidSecLBreadth.Value = hidSecLBreadth.Value + "<table cellpadding='0' cellspacing='0' border='0' width='1250' height='100'><tr><td>";

hidSecLBreadth.Value = hidSecLBreadth.Value + "<DIV id='div2'style = 'BORDER-RIGHT: 1px solid;BORDER-TOP: 1px solid;BORDER-LEFT: 1px solid;BORDER-BOTTOM: 1px solid;";

hidSecLBreadth.Value = hidSecLBreadth.Value + " position:absolute; width:" + dblBuildWidth + "px; height:";

dblTotalWidth =+ dblBuildWidth;

hidSecLBreadth.Value = hidSecLBreadth.Value + dblBuildHeight + "px; z-index:4; left: " + dblBuildLeft;

hidSecLBreadth.Value = hidSecLBreadth.Value + "px; top: " + dblBuildTop + "px; background-color:#C0C0C0;";

hidSecLBreadth.Value = hidSecLBreadth.Value + " layer-background-color: #C0C0C0'><center><font size= " + intFontSize + ">" + strCaption + "</font></center></DIV></td>";

hidSecLBreadth.Value = hidSecLBreadth.Value + " <td width='50%' ></td></tr></table>";

}

I am displaying the hidSecLBreadth.Value into a label in .aspx page.

Answers (2)