1
0
mirror of https://github.com/moparisthebest/app-UI synced 2024-12-22 23:48:48 -05:00
app-UI/samples/01 - viewnavigator/03 - multi instance/index.html

114 lines
3.5 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html>
<head>
<title>View Navigator Multiple Instances</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<script src="../../../src/libs/jquery-1.7.1.js"></script>
<script src="../../../src/libs/jquery.animate-enhanced.js"></script>
<script src="../../../src/libs/iscroll.js"></script>
<script src="../../../src/libs/noClickDelay.js"></script>
<link rel="stylesheet" href="../../../src/viewnavigator/viewnavigator.css" type="text/css" />
<script src="../../../src/viewnavigator/viewnavigator.js"></script>
<style>
#leftDiv {
position:absolute;
top:0px;
bottom:0px;
left:0px;
width:50%;
overflow:hidden;
}
#rightDiv {
position:absolute;
top:0px;
bottom:0px;
left:50%;
right:0px;
width:50%;
border-left:1px solid red;
overflow:hidden;
}
</style>
<script>
$(document).ready( function() {
//Setup the default views
var leftView = getView( "left" );
leftView.backLabel = null;
var rightView = getView( "right" );
rightView.backLabel = null;
//Setup the ViewNavigator
window.leftViewNavigator = new ViewNavigator( '#leftDiv' );
window.leftViewNavigator.pushView( leftView );
window.rightViewNavigator = new ViewNavigator( '#rightDiv' );
window.rightViewNavigator.pushView( rightView );
} );
function leftPushView() {
//create a view and push it onto the view navigator
var view = getView("left");
window.leftViewNavigator.pushView( view );
}
function leftPopView() {
//pop a view from the view navigator
window.leftViewNavigator.popView();
}
function rightPushView() {
//create a view and push it onto the view navigator
var view = getView("right");
window.rightViewNavigator.pushView( view );
}
function rightPopView() {
//pop a view from the view navigator
window.rightViewNavigator.popView();
}
function getView( side ) {
//create a view descriptor with random content
2012-04-20 14:17:37 -04:00
var bodyView = $('<div>' + Math.random().toString() + '<hr><li href="#" onclick="'+side+'PushView()" class="viewNavigator_backButton">push view</li> <li href="#" onclick="'+side+'PopView()" class="viewNavigator_backButton">pop view</li><hr>' + getMeat() + '</div>');
var links = bodyView.find('a');
/*for ( var i=0; i<links.length; i++)
{
NoClickDelay( links[i] );
}*/
return { title: side + "Default View " + parseInt(Math.random()*1000),
backLabel: "Back",
view: bodyView
};
}
function getMeat() {
//randomly generate content
//text string generated by http://baconipsum.com/
var iterations = 1 + parseInt(Math.random() * 25);
var result = "";
for ( var i = 0; i < iterations; i ++ ) {
result += "Pork chop corned beef meatloaf prosciutto flank, chuck andouille fatback hamburger cow ham turkey. Drumstick filet mignon boudin, salami beef ribs ball tip turducken frankfurter chuck. Pork chop swine chuck meatloaf capicola tri-tip. Pork belly venison bresaola flank, jerky ham hock short loin ground round corned beef salami pork filet mignon tri-tip sirloin. Tenderloin meatball corned beef, boudin brisket bresaola rump short loin tri-tip spare ribs pork belly cow.<hr>"
}
return result;
}
</script>
</head>
<body>
<div id="leftDiv"></div>
<div id="rightDiv"></div>
</body>
</html>