need to load and reload the same page for making the links work
hi im developing my first app using jquery mobile, and i have an issue with 2 pages, in both pages if i load normally the page the link doesnt work, and if i reload the page the links works perfect.
in both web pages i have something like this:
- <!DOCTYPE html>
- <html lang="{country_code}">
- <head>
- <!-- META TAGS Declaration -->
- <meta charset="UTF-8">
- <title>MNT Graphic Design - About </title>
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0;" />
- <meta name="apple-mobile-web-app-capable" content="yes" />
- <meta name="author" content="MNT Graphic Design - http://www.mntdesign.co/" />
-
- <!-- CSS Declaration -->
- <link rel="stylesheet" type="text/css" href="{site_url}jquerymobile/css/jquery.mobile-1.3.1.css" />
- <link rel="stylesheet" type="text/css" href="{path='styles/m'}" />
- </head>
- <body>
-
- <div data-role="page" id="about" data-add-back-btn="true">
-
-
- <div data-role="header" data-theme='a' id="header">
- <h1> About Us </h1>
- </div><!-- /header -->
-
-
- <div data-role="content" data-theme='c' >
-
- <div class="choice_list">
-
- <ul data-role="listview" data-inset="true" >
- <li>
- <a href="#david" data-transition="slide">
- <h1>David</h1>
- <img src="http://www.mntdesign.co/uploads/imagenes/_thumb2/216346_10151483715269961_2029946791_n.jpg" alt="projectn1"/>
- <p> hello world! </p>
- </a>
- </li>
- <li>
- <a href="#alejandro" data-transition="slide">
- <h1>Alejandro</h1>
- <img src="http://www.mntdesign.co/uploads/imagenes/_thumb2/216346_10151483715269961_2029946791_n.jpg" alt="projectn2"/>
- <p> hello world! </p>
- </a>
- </li>
-
-
- </ul>
-
- </div>
-
- <p class="copyright">Copyright © MNT. Designed by <a href="http://www.mntdesign.co" class="ui-link">MNTDesign</a></p>
- </div><!-- /content -->
-
- <div data-role="footer" data-theme='a' >
-
- <nav data-role="navbar">
- <ul>
- <li><a href="{path='m'}" data-icon="home">Home</a></li>
- </ul>
- </nav>
-
- </div><!-- /Foother -->
-
- </div><!-- /page -->
- <div data-role="page" id="david" >
- <header data-role="header">
- <h1>Project #1</h1>
- <a href="#about" data-icon="grid" data-iconpos="notext" data-transition="slide">David</a>
- </header>
- <h1>David</h1>
- <p>hello world!</p>
- </div><!-- Page David -->
-
- <div data-role="page" id="alejandro" >
- <header data-role="header">
- <h1>Project #2</h1>
- <a href="#about" data-icon="grid" data-iconpos="notext" data-transition="slide">Alejandro</a>
- </header>
- <h1>Alejandro</h1>
- <p>hello world!</p>
- </div><!-- Page Alejandro -->
-
-
- </body>
- <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
- <script type="text/javascript" src="{site_url}jquerymobile/js/jquery.mobile-1.3.1.js"></script>
-
-
- <script type="text/javascript">
- </script>
-
- </html>
in the second one i have a couple of galleries that i load using photoswipe with the same structure and the only different is the javascript that i use for load the galleries. how can i fix this? i dont want to load twice the same page in order to work.
photoswipe gallery javascript
- <script type="text/javascript">
- (function(window, $, PhotoSwipe){
- $(document).ready(function(){
- $('div.gallery-page')
- .on('pageshow', function(e){
- var
- currentPage = $(e.target),
- options = {},
- photoSwipeInstance = $("ul.gallery a", e.target).photoSwipe(options, currentPage.attr('id'));
- return true;
- })
- .on('pagehide', function(e){
- var
- currentPage = $(e.target),
- photoSwipeInstance = PhotoSwipe.getInstance(currentPage.attr('id'));
- if (typeof photoSwipeInstance != "undefined" && photoSwipeInstance != null) {
- PhotoSwipe.detatch(photoSwipeInstance);
- }
- return true;
- });
- });
- }(window, window.jQuery, window.Code.PhotoSwipe));
- </script>