Can't access accordion in IFrame
I am using the accordion from jQuery together with DotNetNuke. Now the DNN page is loaded into an IFrame dynamicly, so the Page_load event of the page which includes the IFrame, the IFrame is not filled yet.
<div class="dvFrame">
<iframe class="IFrame" marginheight="0" marginwidth="0" frameborder="0" runat="server" id="frmDNN" ></iframe>
</div>
In the page_load:
frmDNN.Attributes.Add("src", ConfigurationManager.AppSettings["dnn"] + request);
The accordion that is loaded into the IFrame:
<div id="accordion">
<div>
<h3><a href="#">First</a></h3>
<div>Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet.</div>
</div>
<div>
<h3><a href="#">Second</a></h3>
<div>Phasellus mattis tincidunt nibh.</div>
</div>
</div>
Now with some Javascript I should be able to say that the div should act like an accordion. But with every attempt, I seem to fail.
$("#accordion"开发者_运维百科).accordion({ header: "h3" });
Can someone help me with this problem, it would be highly appreciated.
I don't know much about DotNetNuke, but I think if you're defining the Accordion javascript in the main page and the accordion HTML in the iFrame you may need to change the javascript to:
window.frmDNN.$("#accordion").accordion({ header: "h3" });
精彩评论