Files
openlayers/master/examples/test_hash-parameter.html
Éric Lemoine 5d14b9e2d4 Updated
2013-02-20 10:38:25 +01:00

71 lines
2.7 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/>
<meta name="apple-mobile-web-app-capable" content="yes" />
<title>Transition Parameter</title>
<link href="../themes/iphone/base.css" rel="stylesheet">
<style>
.lnk {
font-size: 14px;
color: #0B5199;
text-decoration: none;
}
</style>
<script type="text/javascript" src="../../../dojo/dojo.js" djConfig="parseOnLoad: true"></script>
<script language="JavaScript" type="text/javascript">
dojo.require("dojo.hash");
dojo.require("dojox.mobile"); // This is a mobile app.
dojo.require("dojox.mobile.parser"); // This mobile app supports running on desktop browsers
dojo.require("dojox.mobile.compat"); // This mobile app uses declarative programming with fast mobile parser
function loadPage(moveTo){
if(!(moveTo.match(/#(\w+)/))){ return; }
moveTo.match(/#(\w+)(.*)/);
var id = RegExp.$1;
var param = RegExp.$2;
if(!param){ return; }
var container = dojo.byId(id);
// You may want to dynamically load page contents here
container.innerHTML = '<h1 dojoType="dojox.mobile.Heading" back="Home" moveTo="#home">'+param+'</h1>\n'+param;
dojox.mobile.parser.parse(container);
}
dojo.declare(
"dojox.mobile.ViewEx",
dojox.mobile.View,
{
onStartView: function(){
loadPage(location.hash);
},
onBeforeTransitionIn: function(moveTo, dir, transition, context, method){
loadPage("#"+moveTo);
}
});
</script>
</head>
<body style="visibility:hidden;">
<div id="home" dojoType="dojox.mobile.View" selected="true">
<h1 dojoType="dojox.mobile.Heading">Animations</h1>
<h2 dojoType="dojox.mobile.RoundRectCategory">Transition Effects</h2>
<ul dojoType="dojox.mobile.RoundRectList">
<li dojoType="dojox.mobile.ListItem" icon="images/i-icon-1.png" moveTo="#bar&myParam=0001">
Document 0001
</li>
<li dojoType="dojox.mobile.ListItem" icon="images/i-icon-2.png" moveTo="#bar&myParam=0002">
Document 0002
</li>
<li dojoType="dojox.mobile.ListItem" icon="images/i-icon-3.png" moveTo="#bar&myParam=0003">
Document 0003
</li>
</ul>
<div dojoType="dojox.mobile.RoundRect">
After you move to other views, you should also be able to navigate through the views with browser's back and forward buttons. Also, views should be bookmarkable. Note that you can pass parameters (e.g. &amp;myParam=001) to a destination view.
</div>
</div>
<div id="bar" dojoType="dojox.mobile.ViewEx">bar</div>
</body>
</html>