how can I change the position of an element when one touches the other.
here is an example http://jsfiddle.net/mZYR8/1/
so if you look at the example lets say if .title-wrap (yellow) touches .right-wrap (orange) I would like orange to "go" undenith yellow
<div class="wrap">
    <div class="title-wrap">
        <h1>Lorem Ipsum Dolor</h1>
    </div>
    <div class="right-wrap">
        <span>1</span>
        <span>2</span>
        <span>3</span>
        <span>4</span>
    </div>
</div>
<style type="text/css">
    * {
        margin:0;
        padding:0;
    }
    .title-wrap {
        background-color:yellow;
        display:inline-block;
    }
    h1 {
        font-size:20px;
        line-height:40px;
    }
    .right-wrap {
        position:absolute;
        display:inline-block;
        right:0px;
        top:0px;
        background-color:orange;
        padding:20px;
    }
    .right-wrap span {
        display:inline-block;
        width:20px;
        height:20px;
        margin-right:10px;
        background-color:purple;
    }
</style>
from here UPDATED the Question cause "yellow undenith" was not clear
so if one element touches the other I would like to change
position:absolute;
right:0px; 
to position:relative; and it shoudl look like this:

I can change what ever is needed and could also add javascript. but if possible with css only I would like it with css.
thanks for helping!