well i have made some progress at least I have something that kinda works. When I click a link in my list that is coded <a href="#set1">Set 1<a/> my address bar goes to index.php#set1. The function below is suppose to change the page to player.php?set=1 however it doesn't change the page until I refresh my browser,. I have played around with different loading methods like $(document).ready and $(document).load but either they don't work or they give me the same result. Any ideas?
- <script type = "text/javascript">
- function string_contains(haystack, needle) {
- if (haystack.indexOf(needle) == -1) {
- return false;
- } else {
- return true;
- }
- }
- $('#index').live('pagebeforecreate', function () {
- if (string_contains(window.location.hash, "#set") == true) {
- var setnum = (window.location.hash.match(/\d+/));
- $.mobile.changePage("player.php?set=" + setnum, {
- transition: "slideup"
- });
- }
- }); </script>