Saturday, 17 August 2013

Initializing isotope with dynamic data json

Initializing isotope with dynamic data json

I have searched around but no help. My issue is I am using the isotope
jQuery library to show data (of course) and I am trying to do this by
using a dynamic json dataset. I placed the data in a .json file and I'm
reading it in and parsing information, then placing that info in divs
under my container div like so:
$('#infoContainer').append('<div class="hospital ' + $number + '"><p>' + i
+ '<br />' + hospital.address + '<br />' + hospital.citystatezip +
'</p></div>');
Of course that portion is in an .each() function for each hospital. My
problem is that the initialization code won't show the dynamic divs like
it shows when you manually type them. I'm using what is given on the
isotope website:
$('#infoContainer').isotope({
itemSelector: '.hospital'
});
Any ideas?

No comments:

Post a Comment