I am using the swipe event (and http://api.jqueryui.com/slide-effect/) to slide out content. This works fine. However, I need to slide in the next('div') as the previous sibling slides out. I have tried next(), nextAll(), closest() but none seem to do what I require.
Here is the function
function swipeleftHandler(event){
$(this).toggle( "slide" );// div slides out to left
// need to slide in next one here
}
The HTML looks like this
<div id="content2" class="content tabcontent active" data-content="1">
<div id="orders_today" class="datagroup datagroup0"></div>
<div id="orders_last_30_days" class="datagroup datagroup1 hide">
</div>
The swipe event is called like this
$(document.body).on('swipeleft', '.datagroup' ,swipeleftHandler);
The swipe event is being captured correctly, and the first div is sliding off to the left as required. I need the next div to side in. There may be multiple elements in the container with the same class (and unknown ID's), so that's why I tried using next()