Code Monkey home page Code Monkey logo

Comments (4)

EugeneDae avatar EugeneDae commented on July 20, 2024

This is just a demo showing that Magnific Popup can be easily hooked up with History.js and HTML5 History API, not a complete extension. My code probably won't work with AJAX pages out of the box, but it should be easy to make it do so - look for $(document).ready calls and replace them with a "page changed" event listener.

I should note that Magnific Popup itself works perfectly fine with AJAX pages as well Dmitry Semenov's other plugin PhotoSwipe, which has History API support built in.

from magnific-popup-history-api-demo.

rafikov avatar rafikov commented on July 20, 2024

Thanks a lot Eugene.

I'm happy with Magnific Popup but want to load some external pages and have their URL displayed correctly for bookmarking etc. It has to be mydomain.com/external.html with external.html loaded as an AJAX page.

Can it be done with Magnific/your code. Or could you recommend an alternative?

from magnific-popup-history-api-demo.

EugeneDae avatar EugeneDae commented on July 20, 2024

I'm sure it can be done.

The whole code is trivial:
https://github.com/EugeneDae/Magnific-Popup-History-API-Demo/blob/gh-pages/magnific-popup.history.js

This piece reopens the popup when you load a page with the ?item=... query:
https://github.com/EugeneDae/Magnific-Popup-History-API-Demo/blob/gh-pages/magnific-popup.open-item.js

Example: http://eugenedae.github.io/Magnific-Popup-History-API-Demo/?item=images/forest-h800.jpg

If you want this out of the box, as I said, try http://photoswipe.com/

from magnific-popup-history-api-demo.

rafikov avatar rafikov commented on July 20, 2024

I suspect photoswipe works only with images but I want to load HTML pages. Anyways thank you. It seems I'll have to dig into the code=)

from magnific-popup-history-api-demo.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.