Jump to content


  • Content count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About absolutebeginner

  • Rank
  1. Accordion Javascript to change button text

    I worked out how to it using some jQuery. Don't know if it's good practice to mix (regular?) Javascript and jQuery, but here's how I did it. (You guys probably do this better in your sleep) In the button tags, I added IDs named the same as the div IDs, but with "_btn" on the end. The Javascript/jQuery code is this (using a link to google.apis at the top for the jQuery, jQuery code is shown in blue) function Accordion(id) { var x = document.getElementById(id); if (x.className.indexOf("w3-show") == -1) { x.className += " w3-show"; $("#"+id+"_btn").text("Hide details"); } else { x.className = x.className.replace(" w3-show", ""); $("#"+id+"_btn").text("Click for details"); } } Tested on Chrome, FF, IE, Edge and Safari (PC version and iPhone)
  2. Accordion Javascript to change button text

    I have some W3.CSS accordions on a webpage based on this tutorial. They work fine, but I'd like to change the button text too (not just show/hide the div) When shown, I'd like the button to show "Click for details". When hidden, I'd like the button to show "Hide details". Thanks in advance for any assistance/advice you can give me.
  3. Sticky and Responsive Top Navigation

    To reply to my own question, I see the Band template in W3.CSS section has both these features, so I'll dig into the code and see what I come up with.
  4. Sticky and Responsive Top Navigation

    Hi Everyone, First of all, w3Schools is an incredible resource. I was able to find code for Sticky Top Navigation and Responsive Top Navigation. Sticky Top Navigation https://www.w3schools.com/howto/howto_js_navbar_sticky.asp Responsive Top Navigation https://www.w3schools.com/howto/howto_js_topnav_responsive.asp But what I really want is both. Is it possible? Also, I don't know if this is wise, but I'm trying to W3.CSS (which I just discovered) but I settle for anything that works. On a related note, in CSS, what do some styles use "." and some use "#"? Many thanks in advance for any help you can give me?