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 8092215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:14:19+00:00 2026-06-05T20:14:19+00:00

I have a customized show/hide toggle script that I’m using along with CSS3 transitions

  • 0

I have a customized show/hide toggle script that I’m using along with CSS3 transitions for the effects.

The script shows the content when clicked, and hides it when the ‘HideLink’ link is clicked, complete with CSS3 transistions – but only in Opera.

In other browsers the script only works for showing the content, clicking the hide link doesn’t work.

See this JSfiddle: http://jsfiddle.net/xte63/

  • 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-05T20:14:20+00:00Added an answer on June 5, 2026 at 8:14 pm

    These days with show / hide javascript, I prefer to use HTML5’s data-* attributes.

    This can already be used in non-HTML5 browsers via the getAttribute and setAttribute function.

    I’ve quickly tried it against IE7, Chrome and Opera and it seems to work.

    http://jsfiddle.net/ThJcb/

    function showHide(shID) {
        var exDiv = document.getElementById(shID);
        if(exDiv.getAttribute("data-visible") != 'false'){
             document.getElementById(shID+'-show').style.cssText = ';height:auto;opacity:1;visibility:visible;';  
             document.getElementById(shID).style.cssText = ';height:0;opacity:0;visibility:hidden;';  
             exDiv.setAttribute("data-visible" , 'false');
        } else { 
             document.getElementById(shID+'-show').style.cssText = ';height:;opacity:0;visibility:hidden;';  
             document.getElementById(shID).style.cssText = ';height:auto;opacity:1;visibility: visible ;';   
              exDiv.setAttribute("data-visible" , 'true'); 
        }
    }
    

    This allows you to determine the state of the div without having to check for CSS values.

    EDIT: As pointed out in the comments, a typo was on the hide link (onlick instead of onclick) which made it appear the above jsfiddle worked whereas it didn’t. At least not exactly as I made an error in the logic, setting the “data-visible” to false instead of true.

    Here’s an updated jsfiddle: http://jsfiddle.net/ThJcb/4/
    (javascript snippet above updated also)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my application, I am using a listview and have customized the associated array
I have a customized version of SDL 1.2 and pygame 1.9.1 that implement SDL2's
I've been looking at a lot of iOS user interfaces that have been customized.
We have a lot of customized spreadsheet solutions that are being used and we
can some one show me how to hide/show tray icons of other applications/processes using
I have panel that I have customized. I use it to display text. But
Right now I'm using Trac with multiple projects and have customized the project-listing template
I have made customized user registration page. and i have made that on theme
I have a ListView that uses a customized adapter, but I can't click on
I have customized uitableViewcell in which each cell show four data which are related

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.