<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-mobile/1.4.0/jquery.mobile.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-mobile/1.4.0/jquery.mobile.min.css">
<div data-role="page" data-theme="b">
<div data-role="panel" data-position="right" data-display="overlay"></div>
<div data-role="header"></div>
<div data-role="content">
<div data-role="tabs" id="tabs">
<div data-role="navbar">
<ul>
<li><a href="#one" class="ui-btn-active">Tab One</a>
</li>
<li><a href="#two">Tab Two</a>
</li>
<li><a href="#three">Tab Three</a>
</li>
</ul>
</div>
<div id="one" class="ui-body-d ui-content">Here is the content for Tab One. When you're on Tab Two, and you click on Tab One, I should slide in from left to right.</div>
<div id="two" class="ui-body-d ui-content">Here is the content for Tab Two. I should slide in from right to left.</div>
<div id="three" class="ui-body-d ui-content">Here is the content for Tab Two. I should slide in from right to left.</div>
</div>
</div>
</div>
<div data-role="footer"></div>
</div>
JavaScript
$(document).on("tabsbeforeactivate", "#tabs", function (e, ui) {
var reverse = ui.newPanel.index() < ui.oldPanel.index() ? " reverse" : "",
classes = "in slideup" + reverse,
classes2 = "in slidedown" + reverse;
$(ui.newPanel).addClass(classes).one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function () {
$(this).removeClass(classes2);
});
});
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.