Skip to content

Commit

Permalink
[WebUI IntelliHome#7] Modified js script and update js libs
Browse files Browse the repository at this point in the history
  • Loading branch information
skullbocks committed Jul 21, 2014
1 parent 47c0bec commit 7f79f75
Show file tree
Hide file tree
Showing 9 changed files with 117 additions and 7 deletions.
31 changes: 31 additions & 0 deletions assets/public/js/isotope_script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
(function (window, $, undefined) {

$(document).ready(function() {
var $container = $('.iso,#iso');

// Fire Isotope only when images are loaded
$container.imagesLoaded(function(){
$container.isotope({
itemSelector : '.post',
masonry: {
isFitWidth: true,
}
});
});
$("[rel='tooltip']").tooltip();
$('.tile_detail').hammer({}).on("tap", function(event) {
if ( $(this).find('.caption').is( ":hidden" ) ) {
$(this).find('.caption').slideDown( 250 );
} else {
$(this).find('.caption').slideUp( 250 );
}
});
$('.tile_detail').hover(function(){
$(this).find('.caption').slideDown(250);
},
function(){
$(this).find('.caption').slideUp(250);
}
);
});
})(window, jQuery);
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$(document).ready(function() {
$(document).ready(function() {
var $container = $('#iso');

// Fire Isotope only when images are loaded
Expand Down Expand Up @@ -33,7 +33,4 @@
$container.isotope( 'appended', $newElems );
});
});



});
});
65 changes: 65 additions & 0 deletions assets/public/js/libs/fitcolumns.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*!
* fitColumns layout mode for Isotope
* http://isotope.metafizzy.co
*/

( function( window ) {

'use strict';

function fitColumnsDefinition( LayoutMode ) {

var FitColumns = LayoutMode.create('fitColumns');

FitColumns.prototype._resetLayout = function() {
this.x = 0;
this.y = 0;
this.maxX = 0;
};

FitColumns.prototype._getItemLayoutPosition = function( item ) {
item.getSize();

// if this element cannot fit in the current row
if ( this.y !== 0 && item.size.outerHeight + this.y > this.isotope.size.innerHeight ) {
this.y = 0;
this.x = this.maxX;
}

var position = {
x: this.x,
y: this.y
};

this.maxX = Math.max( this.maxX, this.x + item.size.outerWidth );
this.y += item.size.outerHeight;

return position;
};

FitColumns.prototype._getContainerSize = function() {
return { width: this.maxX };
};

FitColumns.prototype.needsResizeLayout = function() {
return this.needsVerticalResizeLayout();
};

return FitColumns;

}

if ( typeof define === 'function' && define.amd ) {
// AMD
define( [
'isotope/js/layout-mode'
],
fitColumnsDefinition );
} else {
// browser global
fitColumnsDefinition(
window.Isotope.LayoutMode
);
}

})( window );
9 changes: 9 additions & 0 deletions assets/public/js/libs/hammer.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7f79f75

Please sign in to comment.