Hello the community !
In a first time i hope my question doesn't exist already, i don't found it.
And all my apologize if i doing some mistake... I'm french and not perfect in english..
I developing a Mobile version of a website and i want put in place a Swipe event for the content.
I don't what swipe all the page but only the content. I show you my page example.
- <body>
- <!-- **********************PAGE ONE************************ -->
- <div id="page1" data-role="page" data-theme="a" >
- <div data-role="header" data-theme="b">
- Page 1
- </div>
- <div data-role="content">
- A content from page 1
- </div>
- <div data-role="footer" data-position="fixed" data-tap-toggle="false">
- <a href="#page-one" data-icon="home" data-inline="true">Contact</a>
- </div>
- </div>
- <!-- **********************PAGE TWO************************ -->
- <div id="page2" data-role="page" data-theme="a" >
- <div data-role="header" data-theme="b">
- Page 2
- </div>
- <div data-role="content" prev-index="3" next-index="2">
- A content from page 2
- </div>
- <div id="content1" data-role="content" prev-index="1" next-index="3">
- A content from page 2
- </div>
- <div id="content2" data-role="content" prev-index="2" next-index="1">
- A content from page 2
- </div>
- <div id="content3" data-role="footer" data-position="fixed" data-tap-toggle="false">
- Footer
- </div>
- </div>
Is it possible ? At the start the content with ID= content2 and Content 3 is hide.
I want that the swipe change only the content and keep the header/Footer immobile.
Before i use a script like that, but this one change all the pages...
- $(document).ready(function() {
- $("[data-role='page']").live('swiperight swipeleft', function(event) {
- var swipeindex = '';
- var reverseValue = false;
- if (event.type == "swiperight") {
- swipeindex = "#page" + $.mobile.activePage.data("prev-index");
- reverseValue = true;
- } else if (event.type == "swipeleft") {
- swipeindex = "#page" + $.mobile.activePage.data("next-index");
- }
-
- if (swipeindex != '#page') {
- $.mobile.changePage(swipeindex, { type : "get", transition : "slide", reverse : reverseValue });
- }
- event.preventDefault();
- });
- });
Thanks for help