开发者

link_to_remote and jquery accordion

开发者 https://www.devze.com 2023-01-01 05:37 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消