0

ポストバック中に現在のアコーディオン ウィンドウを開いたままにする方法を見つけようとしています。私は投稿を見てきましたが、それらはすべて jQuery の実際のアコーディオン機能を使用していますが、私は css だけを使用しています。

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Editor.aspx.vb" Inherits="Editor" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>MLE Editor</title>
    <script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>

    <link href="Styles/site.css" rel="stylesheet" type="text/css" />    

<script type="text/javascript">
    $(document).ready(function () {
        // The Accordion Effect
        $('.eventHeader').click(function () {
            $(this).toggleClass('active-header').toggleClass('inactive-header');
            $(this).next().slideToggle().toggleClass('open-content');
        });
    });
</script>
</head>
<body>
    <form id="form1" runat="server">        
        <div id="eventOptions">
            <div id="eventsContainer"> 
                <h2 class="eventHeader">Event 1</h2><div class="eventContent"><p>Event options</p></div>
                <h2 class="eventHeader">Event 2</h2><div class="eventContent"><p>Event options</p></div>
                <h2 class="eventHeader">Event 3</h2><div class="eventContent"><p>Event options</p></div>
                <h2 class="eventHeader">Event 4</h2><div class="eventContent"><p>Event options</p></div>
                <h2 class="eventHeader">Event 5</h2><div class="eventContent"><p>Event options</p></div>
            </div>
        </div>
        <asp:Button ID="btnPostback" Runat="server" Text="Postback" />
    </form>
</body>
</html>
4

1 に答える 1