').attr('id', 'go-overlay-bg');
this.overlay.append(this.overlayBg);
$('body').append(this.overlay);
this.init = function(){
/*
console.log(this.container);
*/
this.prepareStyle();
this.list.isotope({
itemSelector: '.go-gallery-item',
layoutMode: 'masonry'
});
this.filters.find('a').on('click', this.filter.bind(this));
if(this.container.hasClass('style-squared')){
var item, figure, image;
this.items.each(function(){
item = $(this);
image = $('
').addClass('image').css('background-image', 'url(' + item.find('img').attr('src') + ')');
item.find('figure').append(image);
});
}
//this.items.on('click', this.click.bind(this));
//this.overlay.on('click', this.overlayClick.bind(this));
if(this.lightbox == 'yes'){
$('a.image-wrap', this.container).tosrus();
}
};
this.getWindowSize = function(){
return {
width: this.win.innerWidth(),
height: this.win.innerHeight()
};
};
this.overlayClick = function(event){
this.overlay.hide();
};
this.loadImage = function(source, callback){
var image = new Image();
image.onload = callback;
image.src = source;
};
this.click = function(event){
event.stopPropagation();
var item = $(event.currentTarget);
var figure = item.find('figure');
var source = item.data('source');
var offset = figure.offset();
var win = this.getWindowSize();
var width = figure.width();
var height = figure.height();
/*
console.log(win);
console.log(width);
console.log(height);
*/
var size = {};
size.top = offset.top - scrollY;
size.left = offset.left - scrollX;
size.bottom = win.height - height - size.top;
size.right = win.width - width - size.left;
this.loadImage(source, function(){
this.overlay.css(size);
this.overlayBg.css({
backgroundImage: 'url(' +source + ')',
width: win.width,
height: win.height
});
this.overlay.show();
this.overlay.animate({left: 0, right: 0}, 500, function(){
this.overlay.animate({top: 0, bottom: 0}, 500, function(){
}.bind(this));
}.bind(this));
}.bind(this));
};
this.filter = function(event){
event.stopPropagation();
var link = $(event.target);
var category = link.data('filter');
if(category != ''){
this.list.isotope({filter: '.category-' + category.toLowerCase()});
}
else{
this.list.isotope({filter: ''});
}
return false;
};
this.prepareStyle = function(){
var style = $('