手风琴需要知道它何时折叠

发布于 2024-09-03 21:53:01 字数 89 浏览 10 评论 0原文

我正在使用 Ajax Control Toolkit Accordion Version 1.0.11119.0,我需要知道窗格何时折叠。是否有客户端索引更改事件?

I'm using the Ajax Control Toolkit Accordion Version 1.0.11119.0 and I need to know when a pane colapses. Is there a client side index change event?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦魇绽荼蘼 2024-09-10 21:53:01

没有客户端索引更改事件,但是您可以看一下这个 文章

<script type="text/javascript">
    var accordion;
    var handlerFired;
    function pageLoad() {

        accordion = $find("Accordion1_AccordionExtender"); //parameter should be the ID_AccordionExtender
        accordion.add_selectedIndexChanged(selectedIndexChangedHandler)
    }
    function selectedIndexChangedHandler(sender, args) {
        if (handlerFired) {
            //add this variable to prevent firing the handler twice.
            handlerFired = false;
            return;
        }

        if (confirm("Would you like to change the index from " + args._oldIndex + " to " + args._selectedIndex + "?")) {
            return;
        } else {
            handlerFired = true;
            // if we don't want to change the index, we need to set it to the old value.
            accordion.set_SelectedIndex(args._oldIndex);
        }
    }

</script>


<cc1:Accordion ID="Accordion1" runat="server" HeaderCssClass="accordionHeader" HeaderSelectedCssClass="accordionHeaderSelect"
        ContentCssClass="accordionContent" FadeTransitions="True" FramesPerSecond="40"
        TransitionDuration="250" AutoSize="None" RequireOpenedPane="false" SuppressHeaderPostbacks="false"
        SelectedIndex="-1">
        <Panes>
            <cc1:AccordionPane ID="AccordionPane1" runat="server">
                <Header>
                    <p>
                        Header1</p>
                </Header>
                <Content>
                    <p>
                        This is the content area!</p>
                </Content>
            </cc1:AccordionPane>
            <cc1:AccordionPane ID="AccordionPane2" runat="server">
                <Header>
                    <p>
                        Header2</p>
                </Header>
                <Content>
                    <p>
                        This is the content area!</p>
                </Content>
            </cc1:AccordionPane>
            <cc1:AccordionPane ID="AccordionPane3" runat="server">
                <Header>
                    <p>
                        Header3</p>
                </Header>
                <Content>
                    <p>
                        This is the content area!</p>
                </Content>
            </cc1:AccordionPane>
        </Panes>
    </cc1:Accordion>

There is no client side index change event, but you can implement one take a look at this article.

<script type="text/javascript">
    var accordion;
    var handlerFired;
    function pageLoad() {

        accordion = $find("Accordion1_AccordionExtender"); //parameter should be the ID_AccordionExtender
        accordion.add_selectedIndexChanged(selectedIndexChangedHandler)
    }
    function selectedIndexChangedHandler(sender, args) {
        if (handlerFired) {
            //add this variable to prevent firing the handler twice.
            handlerFired = false;
            return;
        }

        if (confirm("Would you like to change the index from " + args._oldIndex + " to " + args._selectedIndex + "?")) {
            return;
        } else {
            handlerFired = true;
            // if we don't want to change the index, we need to set it to the old value.
            accordion.set_SelectedIndex(args._oldIndex);
        }
    }

</script>


<cc1:Accordion ID="Accordion1" runat="server" HeaderCssClass="accordionHeader" HeaderSelectedCssClass="accordionHeaderSelect"
        ContentCssClass="accordionContent" FadeTransitions="True" FramesPerSecond="40"
        TransitionDuration="250" AutoSize="None" RequireOpenedPane="false" SuppressHeaderPostbacks="false"
        SelectedIndex="-1">
        <Panes>
            <cc1:AccordionPane ID="AccordionPane1" runat="server">
                <Header>
                    <p>
                        Header1</p>
                </Header>
                <Content>
                    <p>
                        This is the content area!</p>
                </Content>
            </cc1:AccordionPane>
            <cc1:AccordionPane ID="AccordionPane2" runat="server">
                <Header>
                    <p>
                        Header2</p>
                </Header>
                <Content>
                    <p>
                        This is the content area!</p>
                </Content>
            </cc1:AccordionPane>
            <cc1:AccordionPane ID="AccordionPane3" runat="server">
                <Header>
                    <p>
                        Header3</p>
                </Header>
                <Content>
                    <p>
                        This is the content area!</p>
                </Content>
            </cc1:AccordionPane>
        </Panes>
    </cc1:Accordion>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文