Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 7c2fb4dab3
Fetching contributors…

Cannot retrieve contributors at this time

file 72 lines (59 sloc) 1.794 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
{% extends "base.html" %}

{% block extra_head %}
<link rel="stylesheet" href="{{ static_url('fancybox/jquery.fancybox-1.3.4.css') }}" type="text/css" media="screen">
<style>
.shots a img { border:1px solid #efefef; margin:15px; padding:3px; }
</style>
{% end %}


{% block content %}

<p class="shots">

{% for file_path, file_path_small, title in images %}
<a href="{{ static_url(file_path) }}" title="{{ title }}"
><img src="{{ static_url(file_path_small) }}" alt="{{ title }}"></a>
{% end %}

</p>

{% end %}

{% block extra_js %}
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script src="{{ static_url('fancybox/jquery.fancybox-1.3.4.pack.js') }}"></script>
<script src="{{ static_url('fancybox/jquery.easing-1.3.pack.js') }}"></script>

<script>
(function($) {
  var cache = [];
  // Arguments are image paths relative to the current page.
  $.preLoadImages = function() {
    var args_len = arguments.length;
    for (var i = args_len; i--;) {
      var cacheImage = document.createElement('img');
      cacheImage.src = arguments[i];
      cache.push(cacheImage);
    }
  }
})(jQuery);

$(function() {

  $('.shots a').fancybox({
    'transitionIn': 'elastic',
    'transitionOut': 'elastic',
    'easingIn' : 'easeOutBack',
    'easingOut' : 'easeInBack',
    'titlePosition': 'inside',
    onComplete: function(element) {
      var nth, href = $(element).attr('href');
      $('.shots a').each(function(i, e) {
        if ($(e).attr('href') == href) {
location.hash = '' + (i + 1);
}
      });
    }
  });

  $('.shots a').each(function(i) {
    $.preLoadImages($(this).attr('href'));
    if (location.hash) {
      if ('#' + (i + 1) == location.hash) {
        $(this).trigger('click');
      }
    }
  });

});
</script>
{% end %}
Something went wrong with that request. Please try again.