2

I want to use photoswipe script on my site to preview images. I downloaded the script, copied two JS files code-photoswipe-1.0.11.min.js and simple-inheritance.min.js. Include them in a file theme.info:

scripts[] = js/code-photoswipe-1.0.11.min.js
scripts[] = js/simple-inheritance.min.js

Next, I overwrite template with image field:

<div id="Gallery">
    <div class="gallery-row">
        <div class="gallery-item">
            <?php print $output; ?>
        </div>
    </div>
</div>

HTML generate this code:

<div id="Gallery">
    <div class="gallery-row">
        <div class="gallery-item">
            <a href="/node/36">
                <img ...">
            </a>
        </div>
    </div>
</div>

But nothing your working. What's wrong? FireBug displays two errors:

Uncaught ReferenceError: SimpleClass is not defined       code-photoswipe-1.0.11.min.js:28
Uncaught TypeError: undefined is not a function                                       8:62
1
  • I include in later versions of JQuery 1.11.1 and changed the order scripts. Now I have no errors, but still nothing works. Oct 17 '14 at 9:28
0

The order of includes should be reversed (as you did). There is also accompanying css file and the following initialization js code (see examples src http://github.com/downloads/dimsemenov/PhotoSwipe/code-photoswipe.v1.0.11.zip).

<script type="text/javascript">

        // Set up PhotoSwipe with all anchor tags in the Gallery container 
        document.addEventListener('DOMContentLoaded', function(){

            Code.photoSwipe('a', '#Gallery');

        }, false);
</script>

Not the answer you're looking for? Browse other questions tagged or ask your own question.