Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page link #28

Open
PeterPan73 opened this issue Mar 5, 2014 · 4 comments
Open

Page link #28

PeterPan73 opened this issue Mar 5, 2014 · 4 comments

Comments

@PeterPan73
Copy link

How can I make as an exemplary'm second page and the addres link in url to be (example) www.site.com/scrollbrowse.html?page=2.
Thanks

@elena87
Copy link

elena87 commented Mar 11, 2014

I have the same issue, I need to have the pages reachable by a URL, beacause I have anchors for every item, and they are reachable only for the first page. How can I achieve this?

@PeterPan73
Copy link
Author

Any help?

@elena87
Copy link

elena87 commented Oct 7, 2014

For the anchors I resolved by disabling jPages if there is an anchor in the URL, but I know it's not the answer for your question.

@bdchauvette
Copy link

I needed to do something similar to this, and came up with the following setup:

/** turn the query string into a javascript object */
function getQueryParams() {
  var queryString = location.search.substr(1).split('&');
  var params = {};

  queryString.forEach(function(param) {
    var p = param.split('=');
    params[p[0]] = p[1];
  });

  return params;
}

/** updates the location bar with the current page */
function updatePageParam(pageNum) {
  var baseUrl = location.pathname.replace(/\/$/, '');
  baseUrl += pageNum > 1 ? '/?page=' + pageNum : '';
  history.replaceState(null, null, baseUrl);
}

/** Paginates the list of categories using jPages plugin */
function paginate() {
  var params = getQueryParams();

  $('.pagination').jPages({
    containerID: 'pages',
    startPage: params.page,
    callback: function(pages) {
      updatePageParam(pages.current);
    }
  });
}

Hope this helps, even though it's quite a few months after you asked the question!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants