I have a standard jquery ui accordion and I load content into it using a link_to_remote tag (in the accordion header). All this works fine. The problem is, once th开发者_运维百科e content is loaded, I dont want a ajax call, I just want the accordion to fold, like it should normally do. I tried doing this using the following jquery but clicking the header hence the link still makes a request.
#lbs_list is the div inside the accordion.
$j('#lnk_show_benefit').bind('click', function(e) {
if ($j('#lbs_list').is(':visible')) {
e.preventDefault();
return false;
} else {
return true;
}
});
Well I used the :before optiopn of link to remote to do this..
:before => "if ($('lbs_list').childElements().size() > 1) {return false}
Not sure if its the best solution though.
精彩评论