Skip to main content

Hash

Provides hash-based navigation, closes Fancybox if it detects the use of the Back button in the browser. Monitors URL hash and looks for element with the same data name e.g. data-fancybox="gallery". Custom values are also supported using data-slug attribute, example:

<a  href="https://lipsum.app/id/32/1600x1200"  data-slug="cat"  data-fancybox="gallery">  <img src="https://lipsum.app/id/32/200x150" /></a>
<a  href="https://lipsum.app/id/22/1600x1200"  data-slug="dog"  data-fancybox="gallery">  <img src="https://lipsum.app/id/22/200x150" /></a>
<a  href="https://lipsum.app/id/23/1600x1200"  data-slug="bird"  data-fancybox="gallery">  <img src="https://lipsum.app/id/23/200x150" /></a>

To disable this plugin, set Hash: false or simply update defaults:

Fancybox.defaults.Hash = false;