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

  • SEARCH
  • Home
  • 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 7782403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:31:59+00:00 2026-06-01T19:31:59+00:00

Please do not beat me a lot of code that is written below. var

  • 0

Please do not beat me a lot of code that is written below.

var flip = 0;
$('#btn').click(function () {
$('#blck').toggle( flip++ % 2 == 0 );
$('#menu-btn') .removeClass('close') .addClass('open')
});

The code I put together pieces of 2, he should perform the opening and closing div, while changing the class of another div.
The problem is that the class of the second object does not change back to the second click … As I understand it should be a condition IF. Help me understand the syntax of the language.

Many thanks in advance and sorry for bad english.

The question is closed. Thanks gillesc. Your suggestion did not work, I had to add:

var flip = 0;
$('#btn').click(function () {
$('#blck').toggle( flip++ % 2 == 0 );
$('#menu-btn').toggleClass('close open');
});

Now everything is in order

  • 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-01T19:32:01+00:00Added an answer on June 1, 2026 at 7:32 pm

    You don’t need a if, just toggle the classes, same for the block just toggle it.

     $('#btn').click(function () {
            $('#blck').toggle();
            $('#menu-btn').toggleClass('close open');
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please not that I fully understand this is a dumb ass idea, but its
I am currently implementing the application that displays hierarchy using ListBoxes (please do not
Please note that this is not homework and i did search before starting this
I'm trying to write some code for a slideshow background. Please not watch what
Please do not mark it as a dupe of this question just yet: Bold
Please do NOT comment on bad practices used here. I am simply trying to
LATER EDIT: Please mention not only game programming books, but also more scientific/simulation oriented
How to check for grid view empty or not please let me know
Don't know why but font is not displaying.Please help. CSS(in css folder): style.css: @font-face
Please note - I am not looking for the right way to open/read a

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.