I'm developing an artist portfolio that's loosely based on the Hegel theme over at Cargo Collective (example: work.eastforkstudio.com).
I've noticed that the theme has a really solid masonry code written.
The layout is fluid, use of the back button works perfectly, and images load in place without needing to find the right place in the container.
Everytime I try not using a css container the content moves way over to the left side.
I sound pretty lost.....
I'll add that my site's working fine WITH a firm css container but I'd like to see if I could make a go without it.
$(function(){
var $container = $('#posts');
var height = $container.height();
if( height > 0 ) { // or some other number
$container.height( height );
}
$container.imagesLoaded(function(){
$container.masonry({
itemSelector: '.entry',
});
});
$container.infinitescroll({
navSelector : '#nav', // selector for the paged navigation
nextSelector : '#nav a#next', // selector for the NEXT link (to page 2)
itemSelector : '.entry', // selector for all items you'll retrieve
loading: {
finishedMsg: 'No more pages to load.',
img: 'http://static.tumblr.com/rahqboa/R0Vmf30bs/loading.gif'
}
},
// trigger Masonry as a callback
function( newElements ) {
// hide new items while they are loading
var $newElems = $( newElements ).css({ opacity: 0 });
// ensure that images load before adding to masonry layout
$newElems.imagesLoaded(function(){
// show elems now they're ready
$newElems.animate({ opacity: 1 });
$container.masonry( 'appended', $newElems, true );
});
}
);
});
A quick glance at the code you posted indicates that some sort of container is required.
It does not specify how large or small it needs to be. If you are trying to fill a whole page just don't set a width on the div (or whatever) is going to be your container.
Or if you do want a width...use a % to make it fluid.
I'm unfamilar enough with JS to ascertain whether it should have an ID of container or just a class.
I'm developing an artist portfolio that's loosely based on the Hegel theme over at Cargo Collective (example: work.eastforkstudio.com).
I've noticed that the theme has a really solid masonry code written.
The layout is fluid, use of the back button works perfectly, and images load in place without needing to find the right place in the container.
Everytime I try not using a css container the content moves way over to the left side.
I sound pretty lost.....
I'll add that my site's working fine WITH a firm css container but I'd like to see if I could make a go without it.
$(function(){}
Of course, everything moves to the left, that's how HTML works.
I'm no JS expert but the container is there to provide an initial structure for the masonry to fit on/in.
I'm not sure what it is you are asking for.
Well, I was curious if I should firmly state a container in my css or if fluid layouts need them at all.
Too, I want to have someone double check my masonry code.
A quick glance at the code you posted indicates that some sort of container is required.
It does not specify how large or small it needs to be. If you are trying to fill a whole page just don't set a width on the div (or whatever) is going to be your container.
Or if you do want a width...use a % to make it fluid.
I'm unfamilar enough with JS to ascertain whether it should have an ID of container or just a class.
Yeah the whole fluid percentage thing confuses me.
I don't know if there is supposed to be a set px number container or what.
This is my site, there's problem a whole host of problems on here.
http://bit.ly/12hw1om
Fluid & solid?
Yeh...you have some work to do because the images don't scale.
Chris has an article or demo somewhere about a masonry type gallery/portfolio page that is also responsive.
I'm on my phone right now so I can't search for it.