dimsemenov / Magnific-Popup

Light and responsive lightbox script with focus on performance.
http://dimsemenov.com/plugins/magnific-popup/
MIT License
11.39k stars 3.48k forks source link

gmaps streetview in popup #961

Closed mm108 closed 7 years ago

mm108 commented 7 years ago

hi,

Thanks for the excellent plugin. I have a simple question here. I can see that it's pretty simple to open a google map using on the popup but I was wondering how do I open the streetview using gmaps plugin? I need to open the following streetview as shown in the link below inside Magnific Popup. Thanks a ton

https://hpneo.github.io/gmaps/examples/streetview.html

How could I open the above inside Magnific?

ghost commented 7 years ago

You can do it fairly easily using type:'inline'

Here's an example of it working: https://codepen.io/ChubbyNinja/pen/ZKErKJ

HTML

<button href="#test-popup">Launch Streetview</button>

<div id="test-popup" class="mfp-hide">
  <div id="panorama"></div>
</div>

CSS

#test-popup {
  position: relative;
  background: #FFF;
  padding: 20px;
  width: auto;
  max-width: 500px;
  margin: 20px auto;
}

#panorama {
  width:100%;
  height:300px;
}

JS

$('button').magnificPopup({
  type:'inline',
    callbacks: {

      // once the modal has opened
      open: function() {

        // create the panorama instance
        panorama = GMaps.createPanorama({
          el: '#panorama',
          lat : 42.3455,
          lng : -71.0983
        });

      }
    }
});
mm108 commented 7 years ago

thank you so much :+1: ... with some work I'd gotten it to work earlier but your method seems to be more elegant :)