PDA

View Full Version : HowTo fix background-attachment on panel with Absolute layout



DenoM
26 Feb 2013, 5:29 AM
There you can see two examples: http://jsfiddle.net/gMpn4/1/
1. background isn't attaching
2. background isn't stretching

How to apply attached background to container?

EPV
26 Feb 2013, 7:34 AM
Your first example looks fine for me, sure it's not something else?

DenoM
26 Feb 2013, 7:53 AM
Let me clarify, when you perform scrolling in the first example the background doesn't move and I need behavior for background like in the second example.
I'm trying to implement this behavior for snapping controls to the grid when user drop it to the panel. (like in the Form Designer in the VisualStudio)
So in the first example background image doesn't moving because ExtJs controls height and scrolling automatically.
I've added third example with right behavior which work correct (Google Chrome):
http://jsfiddle.net/gMpn4/4/
But 'background-attachment:local' isn't cross-browser solution and I'm trying to find another way.

EPV
26 Feb 2013, 9:27 AM
Not really sure what your trying to achieve ...

But, since your using absolute layout you can calculate the width & height of your div in example 2.


html:'<div class="tested" style="height:800px;width:900px"></div>',

Good luck!

DenoM
27 Feb 2013, 2:58 AM
Yes, you're right that possible solution, but in my application container can change it size, and in this case I have to update div.tested size too. I'm trying to fix this problem by overriding AbsoluteLayout and controlling of height manually, but I didn't find way to do that (to set height of container basing on content).