title: Photoswipe UI Default is not defined
body: <p>I'm working on setting up PhotoSwipe with my site but I'm getting an uncaught reference error for </p>
  
  <blockquote>
    <p>PhotoswipeUI_Default is not defined at openPhotoSwipe</p>
  </blockquote>
  
  <p>Here is my code:</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;title&gt;Untitled Document&lt;/title&gt;
  
      &lt;link rel="stylesheet" href="../css/asmStyles.css"&gt;
      &lt;link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.2/photoswipe.css"&gt;
      &lt;link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.2/default-skin/default-skin.css"&gt;
      &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.2/photoswipe.js"&gt;&lt;/script&gt;
      &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.2/photoswipe-ui-default.js"&gt;&lt;/script&gt;
      &lt;script src="../js/my_photoswipe.js"&gt;&lt;/script&gt;
      &lt;script
    src="https://code.jquery.com/jquery-3.3.1.js"
    integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60="
    crossorigin="anonymous"&gt;&lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
  
  &lt;button id="open_photoswipe"&gt;Open Photoswipe&lt;/button&gt;
  
  &lt;!-- Default photoswipe setup --&gt;
      &lt;div class="pswp" tabindex="-1" role="dialog" aria-hidden="true"&gt;
          &lt;div class="pswp__bg"&gt;&lt;/div&gt;
  
          &lt;div class="pswp__scroll-wrap"&gt;
              &lt;div class="pswp__container"&gt;
                  &lt;div class="pswp__item"&gt;&lt;/div&gt;
                  &lt;div class="pswp__item"&gt;&lt;/div&gt;
                  &lt;div class="pswp__item"&gt;&lt;/div&gt;
                  &lt;div class="pswp__item"&gt;&lt;/div&gt;
              &lt;/div&gt;
  
              &lt;div class="pswp__ui pswp__ui--hidden"&gt;
                  &lt;div class="pswp__top-bar"&gt;
  
                      &lt;div class="pswp__counter"&gt;&lt;/div&gt;
  
                      &lt;button class="pswp__button pswp__button--close" title="close(Esc)"&gt;&lt;/button&gt;
  
                      &lt;button class="pswp__button pswp__button--share" title="Share"&gt;&lt;/button&gt;
  
                      &lt;button class="pswp__button pswp__button--fs" title="Toggle fullscreen"&gt;&lt;/button&gt;
  
                      &lt;button class="pswp__button pswp__button--zoom" title="Zoom in/out"&gt;&lt;/button&gt;
  
                      &lt;div class="pswp__preloader"&gt;
  
                          &lt;div class="pswp__preloader__icn"&gt;
                              &lt;div class="pswp__preloader__cut"&gt;
                                  &lt;div class="pswp__preloader__donut"&gt;
                                  &lt;/div&gt;
  
                              &lt;/div&gt;
  
                          &lt;/div&gt;
  
                      &lt;/div&gt;
  
                  &lt;/div&gt;
  
                  &lt;div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap"&gt;
                      &lt;div class="pswp__share-tooltip"&gt;
                      &lt;/div&gt;
  
                  &lt;/div&gt;
  
  
                  &lt;button class="pswp__button pswp__button--arrow--left" title="Previous(arrow left)"&gt;
                  &lt;/button&gt;
  
  
  
                  &lt;button class="pswp__button pswp__button--arrow--right" title="Next(arrow right)"&gt;
                  &lt;/button&gt;
  
  
                  &lt;div class="pswp__caption"&gt;
  
                      &lt;div class="pswp__caption__center"&gt;
                      &lt;/div&gt;
  
  
  
                  &lt;/div&gt;
  
  
              &lt;/div&gt;
  
          &lt;/div&gt;
  
      &lt;/div&gt;
  
  &lt;script type="text/javascript"&gt;
  
  
      var openPhotoSwipe = function () {
          var pswpElement = document.querySelectorAll('.pswp')[0];
          //build items array
  
          var items = [
              {
                  src:'../images/testimage.jpg',
                  h: 600,
                  w: 800
  
              },
              {
                  src: '../images/testimage2.jpg',
                  h: 600,
                  w: 800
  
              }
          ];
  
          var options = {
              history: false,
              focus: false,
  
              showAnimationDuration: 0,
              hideAnimationDuration: 0
          };
  
          var gallery = new PhotoSwipe(pswpElement, PhotoswipeUI_Default, items, options);
  
          gallery.init();
  
      };
  
      openPhotoSwipe();
      document.getElementById('open_photoswipe').onclick = openPhotoSwipe;
  
  
      &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I've been able to get PhotoSwipe working with images shown in thumbnails using different external, more complicated, javascript, but for some reason, this "simplified" demo keeps hitting me with the Uncaught Reference Error. I have tried loading the PhotoSwipe javascript in the header, right before the closing body tag; doesn't work. </p>
  
  <p>I have also tried different variations of calling the new PhotoSwipe constructor, which doesn't seem to be working. </p>
  
  <p>Test site link: <a href="https://www.azsmtest.com/test/test_photoswipe.php" rel="nofollow noreferrer">https://www.azsmtest.com/test/test_photoswipe.php</a></p>