Mason.js for creating a perfect grid with jQuery.
See the codeMason.js is a jQuery plugin that allows you to create a perfect grid of elements.
This is not Masonry, or Isotope or Gridalicious. Mason fills in those ugly gaps, and creates a perfectly filled space.
2.0.2
Basic CSS
#container {
width: 100%;
position: relative;
}
.box {
float: left;
background-color: #00ffff;
position: relative;
}
Call Mason.js (BASIC)
$("#container").mason({
itemSelector: ".box",
ratio: 1.5,
sizes: [
[1,1],
[1,2],
[2,2]
]
});
Mason.js has a number of options:
$("#container").mason({
itemSelector: ".box",
ratio: 1.5,
sizes: [
[1,1],
[1,2],
[2,2]
],
columns: [
[0,480,1],
[480,780,2],
[780,1080,3],
[1080,1320,4],
[1320,1680,5]
],
promoted: [
['class_name', 2, 1],
['class_name', 2, 3],
['class_name', 3, 3],
],
filler: {
itemSelector: '.fillerBox',
filler_class: 'custom_filler',
keepDataAndEvents: false
},
layout: 'fluid',
gutter: 10
},function(){
console.log("COMPLETE!")
});
At times you may want to destroy the mason object and no longer track window changes, to do this assign the mason grid to a variable such as var mason and when you're ready to destroy just call mason.destroy() this will remove all listeners on the mason object and you can remove the grid or elements without any ill effects.
npm installbower installcd into project and run gulp
cd into project
gulp distgulp finish_distLook at the public folder for examples.
95 followers · starred Jun 2013
3,226 followers · starred Nov 2013
135 followers · starred Jul 2013
Mason.js for creating a perfect grid with jQuery.
See the codeMason.js is a jQuery plugin that allows you to create a perfect grid of elements.
This is not Masonry, or Isotope or Gridalicious. Mason fills in those ugly gaps, and creates a perfectly filled space.
2.0.2
Basic CSS
#container {
width: 100%;
position: relative;
}
.box {
float: left;
background-color: #00ffff;
position: relative;
}
Call Mason.js (BASIC)
$("#container").mason({
itemSelector: ".box",
ratio: 1.5,
sizes: [
[1,1],
[1,2],
[2,2]
]
});
Mason.js has a number of options:
$("#container").mason({
itemSelector: ".box",
ratio: 1.5,
sizes: [
[1,1],
[1,2],
[2,2]
],
columns: [
[0,480,1],
[480,780,2],
[780,1080,3],
[1080,1320,4],
[1320,1680,5]
],
promoted: [
['class_name', 2, 1],
['class_name', 2, 3],
['class_name', 3, 3],
],
filler: {
itemSelector: '.fillerBox',
filler_class: 'custom_filler',
keepDataAndEvents: false
},
layout: 'fluid',
gutter: 10
},function(){
console.log("COMPLETE!")
});
At times you may want to destroy the mason object and no longer track window changes, to do this assign the mason grid to a variable such as var mason and when you're ready to destroy just call mason.destroy() this will remove all listeners on the mason object and you can remove the grid or elements without any ill effects.
npm installbower installcd into project and run gulp
cd into project
gulp distgulp finish_distLook at the public folder for examples.
95 followers · starred Jun 2013
3,226 followers · starred Nov 2013
135 followers · starred Jul 2013