$(window).load(function(){ var $container = $('.portfolio_block, .shop_block'); $container.isotope({ itemSelector : '.element', masonry: {columnWidth: 1} }); var $optionSets = $('#options .option-set'), $optionLinks = $optionSets.find('a'); $optionLinks.click(function(){ var $this = $(this); // don't proceed if already selected if ( $this.hasClass('selected') ) { return false; } var $optionSet = $this.parents('.option-set'); $optionSet.find('.selected').removeClass('selected'); $this.addClass('selected'); // make option object dynamically, i.e. { filter: '.my-filter-class' } var options = {}, key = $optionSet.attr('data-option-key'), value = $this.attr('data-option-value'); // parse 'false' as false boolean value = value === 'false' ? false : value; options[ key ] = value; if ( key === 'layoutMode' && typeof changeLayoutMode === 'function' ) { // changes in layout modes need extra logic changeLayoutMode( $this, options ) } else { // otherwise, apply new options $container.isotope( options ); } return false; }); // toggle variable sizes of all elements $('#toggle-sizes').find('a.view_full').click(function(){ $("a").each(function(){ h = this.href; ind = h.indexOf("product_layout="); if (ind>=0) { h = h.replace("columns","rows"); } this.href = h; }); $('.product_item') .removeClass('product_item_columns') .addClass('product_item_rows'); $('.shop_block') .addClass('variable-sizes') .isotope('reLayout'); return false; }); $('#toggle-sizes').find('a.view_box').click(function(){ $("a").each(function(){ h = this.href; ind = h.indexOf("product_layout="); if (ind>=0) { h = h.replace("rows","columns"); } this.href = h; }); $('.product_item') .removeClass('product_item_rows') .addClass('product_item_columns'); $('.shop_block') .removeClass('variable-sizes') .isotope('reLayout'); return false; }); //Load More for Portfolio jQuery.fn.portfolio_addon = function(addon_options) { //Set Variables var addon_el = jQuery(this), addon_base = this, img_count = addon_options.items.length, img_per_load = addon_options.load_count, $newEls = '', loaded_object = '', $container = jQuery('.portfolio_block'); jQuery('.btn_load_more').click(function(){ $('html,body').animate({scrollTop: $(this).offset().top-87}, 'slow'); $newEls = ''; loaded_object = ''; loaded_images = $container.find('.added').size(); if ((img_count - loaded_images) > img_per_load) { now_load = img_per_load; } else { now_load = img_count - loaded_images; } if ((loaded_images + now_load) == img_count) jQuery(this).fadeOut(); if (loaded_images < 1) { i_start = 1; } else { i_start = loaded_images+1; } if (now_load > 0) { if (addon_options.type == 0) { //1 Column Service Type for (i = i_start-1; i < i_start+now_load-1; i++) { loaded_object = loaded_object + '

Praesent a porta eros

'+ addon_options.items[i].content +' Read more...

'; } } else { //2-4 Columns Portfolio Type for (i = i_start-1; i < i_start+now_load-1; i++) { loaded_object = loaded_object + '

'+ addon_options.items[i].title +'

'+ addon_options.items[i].content +'

'; } } $newEls = jQuery(loaded_object); $container.isotope('insert', $newEls, function() { $container.isotope('reLayout'); jQuery("a[rel^='prettyPhoto']").prettyPhoto(); }); } }); } });