[jQuery] selectable not working after loading content through .load the second time
Hey folks,
I've got a problem where I'm trying to use the selectable plugin (very
cool, btw) and it isn't working the second time content is loaded onto
the page..
here's what's happening.
I have a page that has a list of tags on it. When the user clicks
on a tag, it loads a series of images from a database and displays them
in a div.
By default when you go to the page the script loads the latest images.
At the end of the php script that loads images, I have some code that
tells everything in that div to be a selectable.. it looks like:
<script type="text/javascript">
$('#content').Selectable(
{
accept : 'preview',
opacity : 0.2,
selectedclass: 'selecteditem',
helperclass: 'selecthelper',
onselect: function(serial)
{
var selected = serial.hash;
//toggleButtons(1);
}
}
);
</script>
This works as expected and is great. However, when the user
clicks on a tag and the new set of images loads up (I'm using something
like:
$("content" .load("./loadImages.php"));
the selectable rubberband select box works, but none of the items are selectable.
I'm guessing that it's trying to run the selectable code before the images exist.. but even when I do something like:
function applySelectables ()
{
$('#content').Selectable(
{
accept : 'preview',
opacity : 0.2,
selectedclass: 'selecteditem',
helperclass: 'selecthelper',
onselect: function(serial)
{
var selected = serial.hash;
}
}
);
}
$("#content").load("./showRef.php", function() {
applySelectables();
});
it still doesn't work.
I'm not getting any errors returned in the code, so I'm curious if anyone has any suggestions..
cheers!
--
jason schleifer
ah-ni-may-tor | weirdo
<a href="http://jonhandhisdog.com/">http://jonhandhisdog.com/</a>
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/