0

The requirement is that image should be fixed in the right bottom corner of my page.

my code : my_image.style.left = wrapper.clientWidth - my_image.clientWidth; works perfectly in mozilla but it seems that chrome does not understand anything.

I also read article about the same : Understanding offsetWidth, clientWidth, scrollWidth and -Height, respectively

As wrapper width changes as per contents rendered on my page, I cannot give hard-coded values then are there any other attributes which can help me out?

EDIT::: Top is relative and depends on the contents in the wrapper

Thanks.

Community
  • 1
  • 1
user1079065
  • 2,085
  • 9
  • 30
  • 53

1 Answers1

1

Plain CSS would be better for this, as far as I understand your question you just need to set the position to fixed and specify the distance from the window bounds. Fixed position will always be relative to the window, not the parent node or page size. So this should be what you want!

#myimage{
   position:fixed;
   right:0px;
   bottom:0px;
} 

Adding left:0px should make it fill the screen width. Otherwise just set the width as a % to keep it responsive. If you mean page not window then try position:relative.

nepeo
  • 509
  • 2
  • 9
  • hmm.. position fixed definitely works for me on the big 3. Was that with fixed or relative mode? I think I remember something about having to modify the parent node for one to work. – nepeo Oct 09 '14 at 16:12