Archive for June 4th, 2008

Ajax+Django+jQuery solved!

June 04th, 2008 | Category: Uncategorized

Okay, so I managed to fix the problems I was having with jQuery and ajax, no thanks to any of the relevant communities.

But here is my solution, if you were wondering. I’ll be linking to code files, instead of posting code snippets in the blog.

My first problem was getting galleria to see the new image I had just loaded via ajax. At first, I reprocessed the entire list with galleria, but that ended up with some hilarious results. I ended up with images running down the page, multiple times, with the index number added multiple times to the title, so it ended up going 7:7:7:7, for the image title.

Not quite what I wanted!

I then delved into the jcarousel.galleria.js file I got from Alex Wilson’s site, altering a few lines of the code.(Line 163-166)

I also did a bit of code in my on-page javascript, which would remove a few classes and stuff before being processed by galleria. But re-running galleria on the entire list again and again, for each image loaded, is well… tedious. Its slow, and was quite clunky.

So, I then found the most important parts of the galleria code, (Line 140 onwards), and extracted that out into a new function, to process a single image. A bit of editing, and this is the final form: my on-page javascript code.

This works the best, I’ve found, with very minimal jerky movements.

Comments are off for this post