From 2e85dc586ca17517e9cc69a953416a5c7c6105e3 Mon Sep 17 00:00:00 2001 From: Baoshan Sheng Date: Wed, 2 Dec 2015 23:16:48 +0800 Subject: [PATCH] Fix a bug which ignores hash in X-PJAX-URL --- jquery.pjax.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jquery.pjax.js b/jquery.pjax.js index bfcccce4..f99dfbc3 100644 --- a/jquery.pjax.js +++ b/jquery.pjax.js @@ -326,8 +326,8 @@ function pjax(options) { var scrollTo = options.scrollTo // Ensure browser scrolls to the element referenced by the URL anchor - if (hash) { - var name = decodeURIComponent(hash.slice(1)) + if (url.hash) { + var name = decodeURIComponent(url.hash.slice(1)) var target = document.getElementById(name) || document.getElementsByName(name)[0] if (target) scrollTo = $(target).offset().top }