There are some divs with there background divs. By Clicking on settings the current divs hide and the background div displays. When I re arrange the divs (Divs are sorttable). The background divs retains its original position. And then when I want to see its background (Settings div)it rotates it from the old position
The script that rotates
$('.flip_div').click(function() {
var div1 = $(this).parent();
var div2 = $('#'+$(this).attr('attached-with'));
var toHide = div1.is(':visible') ? div1 : div2;
var toShow = div2.is(':visible') ? div1 : div2;
toHide.removeClass('flip in').addClass('flip out').hide();
toShow.removeClass('flip out').addClass('flip in').show();
});
Re arrange the divs then click on settings to see the problem
You can simply wrap both back and front panels with a single element and make it a target of sorting.
So, HTML (see
<div class="single_panel">around back and front section):CSS for that new element:
And updated sortable init code:
Demo: http://jsfiddle.net/AFfNV/3/