Questions tagged [hashchange]

hashchange is a DOM window event that is fired when the URL's fragment identifier changes.

hashchange is a DOM window event that is fired when the URL's changes. Use this tag for questions related to this event and its related event handler onhashchange.

Resources

Related Tags

241 questions
0
votes
1 answer

How many pageview requests it would send to GA metrics?

Whether this code is fine to implement for UA to track hashchange Urls: ga ('send', 'pageview', { 'page': location.pathname+location.search+location.hash, 'title': location.pathname+location.search+location.hash}); How many pageview…
alen
  • 1
0
votes
0 answers

Why hashchange is working but not fully when manually triggered

I'm using a hashchange to fire the below script. The hashchange works just fine but when it's being used to triggering the haschange manually (so when some lands on the page without a hashchange), only $('#gallery-two').desoSlide is fired. It…
Inkling
  • 1
  • 1
0
votes
1 answer

Animate Scroll based on Hash Change

I'm currently working on a site which uses the javascript code below to animate over to the target element inside an href. How would I go about getting the code to animate when the back/forward buttons are clicked based on it's history. /* ------ …
Don
  • 11
  • 1
  • 4
0
votes
1 answer

Hash location basics

I'm trying to understand how location.hash works in jQuery, for that, I'm trying to begin from the most basic form, and then once I get that right I'd go deeper, but sadly I'm already stuck at what I think should be a simple thing. Here's my code I…
Dlacrem
  • 71
  • 3
  • 10
0
votes
1 answer

Changing Hash on Section Change with Scroll

Something is undefined, and it's not working for me. I think I'm doing something wrong, but I can't figure out what. //change the window hash var changeHash = function(a) { document.location.hash = a }; //get the scrollPos var scrollPos =…
jaruesink
  • 1,205
  • 2
  • 14
  • 24
0
votes
4 answers

Hashchange to show divs

I have a number of divs on my page, which are hidden by default. Jobs can be selected by links (to "#job8, for example). I'm trying to use hashchange in my script to check the URL for the specific hash and then to display the appropriate div. This…
khal28
  • 3
  • 3
0
votes
1 answer

Update Bootstrap Carousel based on window.location.hash

The code below updates the hash based on the carousel slide - I'm looking to update the slide based on the hash. The question explains it pretty well. There's a great way to update the window.location.hash onslide var url =…
Lawrence Black
  • 515
  • 1
  • 7
  • 18
0
votes
1 answer

How to use onhashchange with dynamic items

So, I have two select boxes on a webpage, but in different anchors (one on the page, the other in an iframe) and I'm trying to get the code to detect which anchor it's in, and then relay the selected value in that box to a link. Here's my…
user2230111
0
votes
3 answers

Javascript anchor navigation

I am creating a website with the "anchor navigation" like used with facebook and google mail. I have got it working but not fully. When I load the page with something like #contact it won't load it in unless I click the link for it. Also, would…
Callum
  • 1
  • 1
  • 1
0
votes
1 answer

How to prevent the Browser to push a state into the history?

I am currently working on a web site and came across the following problem: Assume my websites name is www.mysite.com. On the first call of the page, my JavaScript checks, whether there are certain parameters in the URL, that are important for the…
tellob
  • 1,220
  • 3
  • 16
  • 32
0
votes
1 answer

jQuery: absolute pathname before hash

I'm currently experiencing some conflict between a hashchange function I have set up and jQuery mobile (used for sliding page transitions). To demonstrate here's an isolated demo on my server: http://nealfletcher.co.uk/transition/ Click on…
user1374796
  • 1,544
  • 13
  • 46
  • 76
0
votes
2 answers

Nothing is loaded when the hash is empty with hashchange

I have a question about the jquery.hashchange.js. I get everything to work, my only problem is when there is no hash. When you first go to the page, it just is: domain.com/ But it should act like: domain.com/#home I tried this, but it wont…
0
votes
1 answer

hashchange event possible bug

I think I've found a really unusual bug in Javascript but I'm not sure. So I have three child divs absolutely positioned inside a parent div (that is position relative). The three child divs are 1200px wide and are side by side inside the parent. So…
Dr. Chocolate
  • 2,043
  • 4
  • 25
  • 45
0
votes
1 answer

hashchange prevents scrolling to targeted div

I have an accordion element, and I need to have different panes expand on hashchange. The code I made, expands it but it doesn't scroll the the targeted div, and page never ends loading. function hashChange() { if (window.location.hash ===…
Bojana Šekeljić
  • 1,056
  • 1
  • 12
  • 30
0
votes
1 answer

jQuery: Math.floor function on hash load

I have a hashchange function set up to change the class of divs and load them into an isotope grid, thus allowing me to navigate to the divs via a hash url. I also have a Math.floor function in there too as the height of .grid-break is determined by…
user1374796
  • 1,544
  • 13
  • 46
  • 76