This question is locked. New answers and comments are not allowed.
I know I ask a lot of questions. But maybe answers will also help other one day (since you get no support tickets - we need to use the forums)
I wanted
a) to have a slide transition when using tabstrip navigation
b) to be able to swipe the views from left and right to get the next view (from left if its left, from right if its right)
Here is what I have and works. Just wondering if there is a smarter way.
index.html in <body>
scripts/app.js
In order to know what view the user swiped from I get the href after the #
I would rather be able to pass a parameter to my swipe function because if I would use multiple .html files this solution would not work.
Looking forward to any ideas and hope this code example might help someone anyhow.
Markus
I wanted
a) to have a slide transition when using tabstrip navigation
b) to be able to swipe the views from left and right to get the next view (from left if its left, from right if its right)
Here is what I have and works. Just wondering if there is a smarter way.
index.html in <body>
<!--Home-->
<
div
id
=
"tabstrip-home"
data-role
=
"view"
data-title
=
"Home"
data-transition
=
"slide"
>
<
div
data-role
=
"content"
class
=
"view-content"
>
<
div
id
=
"touch-home"
data-role
=
"touch"
data-enable-swipe
=
"1"
data-swipe
=
"myTouch.swipe"
>
<
h1
>Home</
h1
>
<
p
>Some Text</
p
>
</
div
>
</
div
>
</
div
>
<!--Settings-->
<
div
id
=
"tabstrip-settings"
data-role
=
"view"
data-title
=
"Settings"
data-transition
=
"slide"
>
<
div
id
=
"touch-settings"
data-role
=
"touch"
data-enable-swipe
=
"1"
data-swipe
=
"myTouch.swipe"
>
<
div
data-role
=
"content"
class
=
"view-content"
>
<
h1
>Settings</
h1
>
<
p
>Some Text</
p
>
</
div
>
</
div
>
</
div
>
<!--About-->
<
div
id
=
"tabstrip-about"
data-role
=
"view"
data-title
=
"About"
data-transition
=
"slide"
>
<
div
id
=
"touch-about"
data-role
=
"touch"
data-enable-swipe
=
"1"
data-swipe
=
"myTouch.swipe"
>
<
div
data-role
=
"content"
>
<
h1
>About</
h1
>
<
p
>Some Text</
p
>
</
div
>
</
div
>
</
div
>
<!--Web-->
<
div
id
=
"tabstrip-web"
data-role
=
"view"
data-title
=
"Web"
data-transition
=
"slide"
>
<
div
id
=
"touch-web"
data-role
=
"touch"
data-enable-swipe
=
"1"
data-swipe
=
"myTouch.swipe"
>
<
div
data-role
=
"content"
>
<
h1
>Web</
h1
>
<
p
>Some Text</
p
>
</
div
>
</
div
>
</
div
>
<!--Layout-->
<
div
data-role
=
"layout"
data-id
=
"tabstrip-layout"
>
<!--Header-->
<
div
data-role
=
"header"
>
<
div
data-role
=
"navbar"
>
<
span
data-role
=
"view-title"
></
span
>
</
div
>
</
div
>
<!--Footer-->
<
div
data-role
=
"footer"
>
<
div
data-role
=
"tabstrip"
>
<
a
href
=
"#tabstrip-home"
data-icon
=
"home"
>Home</
a
>
<
a
href
=
"#tabstrip-settings"
data-icon
=
"settings"
>Settings</
a
>
<
a
href
=
"#tabstrip-about"
data-icon
=
"about"
>About</
a
>
<
a
href
=
"#tabstrip-web"
data-icon
=
"globe"
>Web</
a
>
<
a
onclick
=
"exitFromApp()"
data-icon
=
"history"
>Exit</
a
>
</
div
>
</
div
>
</
div
>
scripts/app.js
window.myTouch = {
swipe :
function
(e) {
var
commingFrom = window.location.href.split(
"#"
)[1];
if
(e.direction ==
"left"
) {
if
(commingFrom ==
"tabstrip-home" || commingFrom ==
"/"
) {
window.location.href =
"index.html#tabstrip-settings"
;
}
else
if
(commingFrom ==
"tabstrip-settings"
) {
window.location.href =
"index.html#tabstrip-about"
;
}
else
if
(commingFrom ==
"tabstrip-about"
) {
window.location.href =
"index.html#tabstrip-web"
;
}
else
if
(commingFrom ==
"tabstrip-web"
) {
window.location.href =
"index.html#tabstrip-home"
;
}
}
else
{
if
(commingFrom ==
"tabstrip-home" || commingFrom ==
"/"
) {
window.location.href =
"index.html#tabstrip-web"
;
}
else
if
(commingFrom ==
"tabstrip-web"
) {
window.location.href =
"index.html#tabstrip-about"
;
}
else
if
(commingFrom ==
"tabstrip-about"
) {
window.location.href =
"index.html#tabstrip-settings"
;
}
else
if
(commingFrom ==
"tabstrip-settings"
) {
window.location.href =
"index.html#tabstrip-home"
;
}
}
}
}
In order to know what view the user swiped from I get the href after the #
I would rather be able to pass a parameter to my swipe function because if I would use multiple .html files this solution would not work.
Looking forward to any ideas and hope this code example might help someone anyhow.
Markus