views:

70

answers:

3

I have a room div with some toy divs arranged on it, see alt text

Toys are absolutly positioned and are drag-able with in the walls of the room . The room container div has a fixed height and height, so the room has horizontal as well as vertical scrolls. I use jquery event drag plug-in for setting up DnD. I managed to set up the toys drag only with in the lomits of the wall, but when there are scrolls, component is moving a little ouside the wall (only up to the actual width of the wall).

I want to show only a portion of the toy as shown below alt text

I tried setting the z-index, but has no effect, any one has better idea?

+1  A: 

Withouth seeing the actual code, i guess overflow:hidden could solve this?

Peter Smeekens
`overflow:hidden` has no effect as the `toy` divs are absolutely positioned.
Mithun P
see my answer above, overflow:hidden *should* be the solution
michael
A: 

You can used scrollTo plugin http://demos.flesler.com/jquery/scrollTo/ to work with scrollbars

JQuery Guru
A: 

the example below shows that overflow:hidden does indeed do what you're asking. Something is up with your code, but we can't help you unless you post it!

alt text

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml"&gt;
    <head>
        <title>Example</title>

        <style type="text/css">

            #container {
                background-color:#ddddff;
                height:300px;
                overflow:hidden;
                position:relative;
                width:300px;
            }

            #container .child {
                background-color:#ddffdd;
                height:50px;
                position:absolute;
                width:50px;
            }

            #container .child1 {
                left:100px;
                top:70px;
            }

            #container .child2 {
                left:270px;
                top:170px;
            }

        </style>
    </head>

    <body>

        <div id="container">
            <div class="child child1"></div>
            <div class="child child2"></div>
        </div>

    </body>
</html>
michael