php - Prepend New Section To Jquery UI Accordion When Link Is Clicked...? (Code Igniter) -
i'd add new section jquery ui accordion when clicks link, either on same page or different page. i've looked @ append() function content i'd pulling in contain php html, it'd need parsed.
the link user clicking reference database record pull e.g. /site/index/record/3 (i'm building in code igniter).
what best way this?
i thinking of using prependto (if that's right), pulling content in via ajax? not sure how work, clicking through page though.
any ideas, suggestions, pointers or comments gratefully appreciated, i've no idea how this.
here's accordion js have:
$(function() { // jquery ui accordion mods sorting var stop = false; $("#ccaccordion h3").click(function( event ) { if ( stop ) { event.stopimmediatepropagation(); event.preventdefault(); stop = false; } }); $("#ccaccordion") .accordion({ header: "> div > h3", autoheight: false, change: function(event, ui){ ui.newheader.parent().prependto(this); // move active panel top of accordion } }) .sortable({ axis: "y", handle: "h3", stop: function() { stop = true; } }); $(".new_accordian").click(function( event ) { $('#ccaccordion').prepend("<div><h3><a href=\"#\">section x</a></h3><div><p>sed non urna. donec et ante. phasellus eu ligula. vestibulum sit amet purus. vivamus hendrerit, dolor @ aliquet laoreet, mauris turpis porttitor velit, faucibus interdum tellus libero ac justo. vivamus non quam. in suscipit faucibus urna.</p></div></div>"); }); });
thanks!
i've accomplished altering html add new accordion section calling following:
$("#days").accordion('destroy').accordion({ autoheight: false ,navigation: true ,collapsible: true ,active: false });
where <div id="days">...</div>
container holds accordion sections. must destroy re-initialize accordion when adding new elements.
so new section via ajax, append() html accordion container re-create accordion.
Comments
Post a Comment