开发者

Getting accordion plugin work within Ajax

My website uses AJAX to present content. When click in main menu, page1.html opens in content-div. On page1.html I want to present content using jQuery accordion menu. How can I get it working in file called w开发者_如何学Pythonith AJAX?

Accordion menu requires these files are currently presented in index.html.

<script type="text/javascript" src="jquery.min.js"></script>
<script type='text/javascript' src='jquery.cookie.js'></script>
<script type='text/javascript' src='jquery.hoverIntent.minified.js'></script>
<script type='text/javascript' src='jquery.dcjqaccordion.2.6.min.js'></script>
<script type="text/javascript"> 
    $(document).ready(function($){
        $('.accordion-1').dcAccordion({
            eventType: 'click',
            autoClose: true,
            saveState: false,
            disableLink: false,
            showCount: false,
            speed: 'normal'
        });         
    });
</script>

I'm using Design Chemicals jquery vertical accordion menu. http://bit.ly/eIMnl1


The problem is that you are running this plugin code before you AJAX appends the new elements in content-div. Just put the initialization code in the success callback in your AJAX request.

success: function() {
    $('.accordion-1').dcAccordion({
        eventType: 'click',
        autoClose: true,
        saveState: false,
        disableLink: false,
        showCount: false,
        speed: 'normal'
    });
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜