由于 class=panel 和 sortable 你面临这个问题所以我做了两个改变。1. 添加了一个带有 class=panel 的 div,并从所有部分中删除了 class=panel 2. 将 java 脚本更改了一点 HTML
<!doctype html>
<body>
<div id="pagewrap">
<aside id="sidebar">
<div class="pannel">
<section id="pannel_front_1" >
<h4 class="pannel_title">Pannel 1</h4>
<span class="flip_div div_menu" attached-with="pannel_back_1" >Settings</span>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, consequat.</p>
</section>
<section id="pannel_back_1" style="display:none">
<h4 class="pannel_title">Back Side 1</h4>
<span class="flip_div div_menu" attached-with="pannel_front_1">back</span>
<p>Back Side.</p>
</section>
</div>
<div class="pannel">
<section id="pannel_front_2" >
<h4 class="pannel_title">Pannel 2</h4>
<span class="flip_div div_menu" attached-with="pannel_back_2" >Settings</span>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit,</p>
</section>
<section id="pannel_back_2" style="display:none">
<h4 class="pannel_title">Back Side 2</h4>
<span class="flip_div div_menu" attached-with="pannel_front_2">back</span>
<p>Back Side.</p>
</section>
</div>
<div class="pannel">
<section id="pannel_front_3" >
<h4 class="pannel_title">Pannel 3</h4>
<span class="flip_div div_menu" attached-with="pannel_back_3" >Settings</span>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
</section>
<section id="pannel_back_3" style="display:none">
<h4 class="pannel_title">Back Side 3</h4>
<span class="flip_div div_menu" attached-with="pannel_front_3">back</span>
<p>Back Side.</p>
</section>
</div>
<div class="pannel">
<section id="pannel_front_4" >
<h4 class="pannel_title">Pannel 4</h4>
<span class="flip_div div_menu" attached-with="pannel_back_4" >Settings</span>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>
</section>
<section id="pannel_back_4" style="display:none">
<h4 class="pannel_title">Back Side 4</h4>
<span class="flip_div div_menu" attached-with="pannel_front_4">back</span>
<p>Back Side.</p>
</section>
</div>
<div class="pannel">
<section id="pannel_front_5" >
<h4 class="pannel_title">Pannel 5</h4>
<span class="flip_div div_menu" attached-with="pannel_back_5" >Settings</span>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>
</section>
<section id="pannel_back_5" style="display:none">
<h4 class="pannel_title">Back Side 5</h4>
<span class="flip_div div_menu" attached-with="pannel_front_5">back</span>
<p>Back Side.</p>
</section>
</div>
<!-- pannel end -->
</aside>
<!-- sidebar ends-->
</div>
<!-- pagewrap ends-->
</body>
</html>
脚本
$(document).ready(function(){
$(function() {
$( "#sidebar" ).sortable({
connectWith: ".pannel",
}).disableSelection();
});
$('.flip_div').click(function() {
var div1 = $(this).parent();
var div2 = $('#'+$(this).attr('attached-with'));
$(div1).removeClass('flip in').addClass('flip out').hide();
$(div2).removeClass('flip out').addClass('flip in').show();
});
});
它已经完成了。试试看。