Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8736219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:15:21+00:00 2026-06-13T10:15:21+00:00

I have a panel that slides down when you click on a button. I

  • 0

I have a panel that slides down when you click on a button. I also have another button on the buttom of the page that toggles the same pane. The problem is, they work independently of each other, so when a button is clicked, it starts the chain over.

HTML

<div id="videoPane">
     content inside panel
     //NOTE: the below anchor has a negative bottom margin, so it remains in plain view when the panel is closed.
     <a href="#" class="close"><img src="images/arrow.png"></a>
</div>

<div id="footerNav">
    <a class="vidbtn" id="b4" href="#">Watch Video</a>
</div>

I would like both a.vidbtn and a.close to perform the same task: opening up the panel; however, they need to work WITH eachother.

My Jquery is as follows:

$("#videoPane a").toggle(function(e){

    $("#videoPane").addClass("videoExpanded");
    $("#b4").addClass("activeBtn");

    e.preventDefault();

}, function(e){
    $("#videoPane").removeClass("videoExpanded");
    $("#b4").removeClass("activeBtn");

    e.preventDefault();
});



$("#b4").toggle(function(e){

    $("#videoPane").addClass("videoExpanded");
    $("#b4").addClass("activeBtn");

    e.preventDefault();

}, function(e){
   $("#videoPane").removeClass("videoExpanded");
    $("#b4").removeClass("activeBtn");

    e.preventDefault();
});

The code is straightforward: they both toggle the same element, #videoPane, and they need to work WITH eachother in sync.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T10:15:23+00:00Added an answer on June 13, 2026 at 10:15 am

    Create a separate function to toggle the video pane, then call it on click from the other elements:

    $("#videoPane a, #b4").click(function (e) {
        e.preventDefault();
        toggleVideoPane();
    });
    
    var toggleVideoPane = function () {
        var $videoPane = $('#videoPane');
        if ($videoPane.hasClass('videoExpanded')) {
            $("#videoPane").removeClass("videoExpanded");
            $("#b4").removeClass("activeBtn");        
        ​} else {
            $("#videoPane").addClass("videoExpanded");
            $("#b4").addClass("activeBtn");            
        }
    };​​​​​​​​​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form that slides down on click signin and slides up on
I have a tooltip attached to a panel that can slide down on the
I have a page that above it I want to have a panel that
I'm trying to create a 'modal' slide down panel for a page. I have
I have slide down panel created in JQuery into a table, that panel contains
I have a panel that is docked to the left and another panel that
i have a panel having slide toggle effect on click of a button along
I have panel that is using group layout to organize some label. I want
I have a panel that is anchored to the top, left, right, bottom of
I have a panel that draws alot of things. To make drawing effecient I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.