Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function(){
- var productions = {
- init: function() {
- this.iso();
- this.fetch();
- $('.prod').on('mouseenter',this.mouseenter)
- .on('mouseleave',this.mouseleave);
- //.on('click',this.dim);
- $('.titre-projet').find('a').on('click',this.dim);
- console.log('after fetch call');
- },// init()
- fetch: function() {
- $.ajax({
- url: '../assets/json/productions.json',
- type: 'GET',
- dataType: 'json',
- success: productions.fetchSucceed,
- error: function(xhr, status, error) {
- console.log(xhr.status);
- }
- });
- console.log("fetch");
- },
- fetchSucceed: function(data) {
- var template = Handlebars.compile( $('#productions-template').html() );
- var temp = template(data.productions);
- $('#productions').append(temp);
- },
- iso: function() {
- var container = $('#productions');
- // initialize isotope
- container.isotope();
- //On affiche seulement la catégorie selectionnée
- $('ul#rubriques-filters li a').on('click',function() {
- var selector = $(this).data('filter');
- container.isotope({ filter: selector });
- return false;
- });
- },// iso()
- mouseenter: function() {
- //On cache l'image principale pour afficher la descriptions du projet
- $this = $(this);
- $this.find('div.prod-img').animate({'margin-top': '-320px'}, 300);//hide
- $this.find('div.prod-hover').animate({'top': '0'},300);//show
- },// mouseenter()
- mouseleave: function() {
- $this = $(this);
- $this.find('div.prod-img').animate({'margin-top': '0px'}, 250);
- $this.find('div.prod-hover').animate({'top': '320px'},250);
- },// mouseenter()
- dim: function() {
- var dim = $('#dim'),
- video = dim.find('.dim-video-projet');
- dim.css("height",$(document).height());
- if( dim.is(':hidden') ) {
- $('<iframe src="http://player.vimeo.com/video/55767554?title=0&byline=0&portrait=0&color=ffffff" width="960" height="540" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>')
- .appendTo(video);
- dim.fadeIn(500);
- }
- dim.find('img').on('click',function(){
- if( dim.is(':visible') ) {
- dim.fadeOut(500);
- video.empty();
- }
- });
- return false;
- }
- };
- productions.init();
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement