Commits

Luke Plant committed 7f77436

Fixed photo gallery javascript

  • Participants
  • Parent commits 30412dd

Comments (0)

Files changed (2)

File christchurch/templates/cmsplugin_gallery/gallery.html

 {% load thumbnail %}
 
-{# have to load it here to stop django-cms stomping on it when logged in #}
-<script type="text/javascript" src="{{ STATIC_URL }}christchurch/js/jquery.tools.min.js"></script>
-
-<div class="gallery" id="cmspluginGallery{{ gallery.pk }}">
+<div class="gallery">
 	{% for image in images %}
 		<div>
 			<img src="{% thumbnail image.src 115x80 crop %}" alt="{{ image.alt }}" title="{{ image.title }}" rel="#cmspluginGalleryImage{{ image.pk }}" />
 	<img src="{{ image.src.url }}" />
 </div>
 {% endfor %}
-
-<script type="text/javascript">
-	jQuery('#cmspluginGallery{{ gallery.pk }} img').overlay();
-</script>

File christchurch/templates/standard.html

 </script>
 {% endaddtoblock %}
 
+{# it doesn't work if we add this in the 'gallery.html' template #}
+{% addtoblock "js" %}
+<script type="text/javascript" src="{{ STATIC_URL }}christchurch/js/jquery.tools.min.js"></script>
+{% endaddtoblock %}
+{% addtoblock "js" %}
+<script type="text/javascript">
+jQuery(document).ready(function () {
+    jQuery('.gallery img').overlay();
+});
+</script>
+{% endaddtoblock %}
+
+
   {% render_block "js" %}
 </body>
 </html>