最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Using Fancybox 3 when "#" is already part of URL - Stack Overflow

programmeradmin1浏览0评论

Fancybox 3 uses the hashtag to persist the current view in the URL:


However, this is too bad for a site where navigation already requires hashtags:


Fancybox 3 will replace this to



Is there a way to use both this navigation and Fancybox 3 at the same time?

Fancybox 3 uses the hashtag to persist the current view in the URL:

http://example./sites/site1#gallery-1

However, this is too bad for a site where navigation already requires hashtags:

http://example./#/sites/site1

Fancybox 3 will replace this to

http://example./#gallery1

Is there a way to use both this navigation and Fancybox 3 at the same time?

Share Improve this question asked May 7, 2017 at 14:37 bytecode77bytecode77 14.9k31 gold badges117 silver badges149 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 6

It seems like Fancyapps anticipated this and added an option for it that works smoothly:

$.fancybox.defaults.hash = false;

Well, it is kinda impossible to have two hashes at the same time, therefore fancyBox replaces with gallery hash, but restores original after closing. If this is causing trouble for you, then yes, disabling hash module would be best option.

btw, you can use gulp to build your own fancybox.js file without hash module; or you can pass hash: false option to disable (from v3.1).

发布评论

评论列表(0)

  1. 暂无评论