Jump to content

8OO

Members
  • Content Count

    33
  • Joined

  • Last visited

Everything posted by 8OO

  1. 8OO

    Accordion Issue

    Also the tech advisor from CM1 just got back to me right now and this is what she said: In CM1 we can't exclude the <p> tag instead we can try and update the JS to look for the elements under <p> tag and process them. var list = document.getElementsByTagName("p"); You can then iterate through the list and find the divs to process them. list.getElementsByTagName("div")[0] I'm not sure where list.getElementsByTagName("div")[0] goes in the original code or if it would work and remove the CDATA thing, since I'm not familiar with JavaScript
  2. 8OO

    Accordion Issue

    So good news is that adding a div to contain everything, like you said, got rid of extra paragraphs being added. Bad news, it's still not working... I'm not adding it at all actually, it's being auto added by my CMS editing program, CM1. Any time I directly copy and paste the JavaScript section of the accordion code in, it just adds CDATA in there. I'm not even sure what it stands for or what it does. When placed in Notepad++ (the editor I use before putting into CM1), I notice that when I test it, the text doesn't come out, which is the same problem I have in CM1. But when I remove CDATA
  3. 8OO

    Accordion Issue

    Tried changing that line, but it's still not working, unfortunately... Although I'm not sure if it's because the extra paragraph elements are screwing it up. This is what the tech person said: "Once it's within CMS code, the the next sibling would be different than when the code is run independent. Please try and identify the element we would want to target keeping CMS tags in account to address the issue. Page source would indicate that additional <p> and <div> tags are included when published from CMS. Uncaught TypeError: Cannot read property 'style' of null
  4. 8OO

    Accordion Issue

    I compared the code from W3 to the code sent by the CMS tech and there's extra paragraphs being added to the buttons which I would assume is causing all these issues. Here's the original code: <h2>Accordion</h2> <button class="accordion">Section 1</button> <div class="panel"> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p> </div> <button clas
  5. 8OO

    Accordion Issue

    Sorry about that, first time using these forums. Tried that but didn't work. It's just reading over the comment I inserted. On one hand I think this CDATA code, inserted by my CMS, is screwing it up. I'm not sure what it is or what it does (still new to JavaScript), but I definitely don't think it should be there as it wasn't found in the original code from W3 Schools (https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_accordion). On the other hand my CMS technician is saying that the error is coming from this line (see image attached): if (panel.style.displa
  6. 8OO

    Accordion Issue

    It's weird because even if I take the exact code from W3 Schools on how to make an Accordion (https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_accordion), it still doesn't work. Everything is fine except that the text doesn't show at all when the button is clicked. I'm not sure if it's something on my CMS because it adding stuff to the code. I'm really not sure what's going on. It's auto adding Java Script comments and the CDATA when I put it in <script>// <![CDATA[ //<![CDATA[var acc = document.getElementsByClassName("accordion"); var i; for (i = 0; i < acc.len
  7. 8OO

    Accordion Issue

    Having a big issue with something seemingly difficult. I'm working in Percussion CM1 (a content editing system) to create an accordion for a few of my webpages, but for some odd reason, it doesn't want to open or collapse. Everything else works such as the hover function and what not, but the sections when clicked do not open. It works on W3 (obviously) and it works on Notepad++ but it doesn't work on CM1. Here's my original code: <style> .accordion { background-color: #eee; color: #444; cursor: pointer;
×
×
  • Create New...