collapsible panel

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • readbanana
    New Member
    • Jul 2010
    • 37

    #1

    collapsible panel

    I have a collapsible panel that opens and closes with javascript. I also have a link button on the page. I want that when someone clicks on that link, it should open the collapsible panel and focus on a specific button. The problem that I have is that until the panel is open I can't have the panel open I can't have javascript scroll me down and by then it's too late. My collapsible panel is really just a bunch of divs. They are in a user control on an aspx page. I tried calling the same function to open and close the panel on this asp button click event just like i do in the user control. I figured if this opens the page it can then scroll and i can use server side code to focus. It doesn't seem to react to the code. I guess cause this button is not in the divs? i hope someone has an idea for me, i'm getting very frustrated.

    Code:
    <script language="javascript" type="text/javascript">
     // current animated collapsible panel content
    
    var currentContent = null;
    
    function togglePannelAnimatedStatus(content, interval, step)
    {
        // wait for another animated expand/collapse action to end
        if (currentContent==null)
        {
            currentContent = content;
            var expand = (content.style.display=="none");
            if (expand)
                content.style.display = "block";
            var max_height = content.offsetHeight;
    
            var step_height = step + (expand ? 0 : -max_height);
            toggleChevronIcon(content);
                    
            // schedule first animated collapse/expand event
            content.style.height = Math.abs(step_height) + "px";
            setTimeout("togglePannelAnimatingStatus("
                + interval + "," + step
                + "," + max_height + "," + step_height + ")", interval);
        }
    }
    heres my html
    Code:
     <asp:LinkButton ID="btnEdit" runat="server" Text="Edit" OnClick="btnEdit_Click" OnClientClick="togglePannelAnimatedStatus(this.nextSibling,50,50)"></asp:LinkButton>
      <uc:CollapsePanel id="CollapsePanel" runat="server" />
Working...