简体   繁体   中英

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.

我对DotNetNuke的了解不多,但是我想如果您要在主页上定义Accordion javascript和在iFrame中定义Accordion HTML,则可能需要将javascript更改为:

window.frmDNN.$("#accordion").accordion({ header: "h3" });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM