granviace / mobile-bookmark-bubble

Automatically exported from code.google.com/p/mobile-bookmark-bubble
Apache License 2.0
0 stars 0 forks source link

Will cause the homepage to swipe to page 2 when used with jquery #20

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Testing with JQuery Mobile jquery.mobile-1.0rc2.min.js
2. upon loading, page moves to left and an empty page is displayed with the 
bubble
3.

What is the expected output? What do you see instead?
bubble should be displayed on the homepage and not cause firstpage to move to 
left

What version of the product are you using? On what operating system?
Tested with all iphones and ipad versions

Please provide any additional information below.

Original issue reported on code.google.com by bigmas...@gmail.com on 3 Nov 2011 at 4:15

GoogleCodeExporter commented 8 years ago
after some investigation, this is caused by addition of bmb=1 to the URL in 
window.location.hash += parameter;.

This adds #/bmb=1  to the URL which causes a page swipe.  

Original comment by bigmas...@gmail.com on 3 Nov 2011 at 4:19

GoogleCodeExporter commented 8 years ago
As a workaround, I use the HTML5 history object to adjust the URL without a 
page refresh, and without using the hash tag.  This seems to work for me.  See 
below for code:

var parameter = 'bmb=1';

bubble.hasHashParameter = function () {
  return window.location.search.indexOf(parameter) != -1;
};

bubble.setHashParameter = function () {
  if (!this.hasHashParameter()) {
    if (window.location.search.indexOf('?') == -1) {
      window.history.replaceState('Object', 'Title', window.location + '?' + parameter);
    } else {
      window.history.replaceState('Object', 'Title', window.location + '&' + parameter);
    }
  }
};

Original comment by AndrewKo...@gmail.com on 28 Jul 2012 at 3:39