A
A
Alexander Mashtalir2015-03-10 17:19:46
JavaScript
Alexander Mashtalir, 2015-03-10 17:19:46

How to load fancybox modal via hash?

It is necessary to initiate the loading of the modal window through the anchor link, for example:
site.ru/#callback

For the modal window I use fancybox

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Mokhov, 2015-03-10
@mokhovcom

if I understand you correctly, then when loading the page, if the #callback anchor is passed in the browser line, then a modal window with id = callback should be displayed, if so, then:

$(document).ready(function () {
    var modal;
    if (window.location.hash && (modal = $(window.location.hash)) && modal.length) {
        // тут код, который отобразит модальное окно
    }
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question