I have a task to dispaly a div starts from the left position of some other control.
I had searched on so many sites but, unfortunately I have not found any good solution.
But, finally I found a solution, as I know the default left on 1024 x 768 is "251" so I use this as a gift of god.
Following is the code how to do that:-
var obj=document.getElementById("a1");
var int_left=screen.width; // get Pixel size of screen
if (int_left>1024)
{
int_left=int_left-1024; // get width other then 1024
int_left=int_left/2; get the first half of width
int_left=int_left+251; add first half to the width
}
else
{
int_left=253;
}
obj.style.left=int_left;
If you have any doubts please let me know.
Set Left,Top at different screen resolution by JavaScript
An IT Solution is a purpose and value-driven organization where everyone is empowered to take decisions in line with our culture. We provide a unique environment of freedom, flexibility & trust that allows an individuals potentials to flower; this results in tremendous growth opportunities.Such a culture, naturally, appeals to everyone. We listen, we think and we act. The IT field is all about thought leadership. We invest in thought for you as customers
No comments:
Post a Comment