{"id":9464,"date":"2024-01-09T18:03:00","date_gmt":"2024-01-09T18:03:00","guid":{"rendered":"https:\/\/codehim.com\/?p=9464"},"modified":"2024-01-22T16:04:57","modified_gmt":"2024-01-22T11:04:57","slug":"javascript-code-for-collapsible-content","status":"publish","type":"post","link":"https:\/\/codehim.com\/accordion\/javascript-code-for-collapsible-content\/","title":{"rendered":"JavaScript Code For Collapsible Content"},"content":{"rendered":"<p>This JavaScript code provides an interactive way to create collapsible content sections on your web page. It works by allowing users to click on accordion headers to <a href=\"https:\/\/codehim.com\/accordion\/accordion-expand-collapse-animation-css\/\" target=\"_blank\" rel=\"noopener\">expand or collapse<\/a> the associated content. It helps you organize and present information neatly, making it easy for your website visitors to access specific details.<\/p>\n<h2>How to Create Collapsible Content Section Using JavaScript<\/h2>\n<p>1. First of all, load the <a href=\"https:\/\/necolas.github.io\/normalize.css\/\" target=\"_blank\" rel=\"noopener\">Normalize CSS<\/a> by adding the following CDN link into the head tag of your webpage.<\/p>\n<pre class=\"prettyprint linenums lang-html\">&lt;link rel=\"stylesheet\" href=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/normalize\/5.0.0\/normalize.min.css\"&gt;<\/pre>\n<p>2. In your HTML file, create the structure for your collapsible content. Here&#8217;s an example of how you can structure your content:<\/p>\n<pre class=\"prettyprint linenums lang-html\">&lt;main&gt;\r\n  &lt;div class=\"accordion\"&gt;\r\n    &lt;div class=\"accordion-item\"&gt;\r\n      &lt;div class=\"accordion-header\"&gt;\r\n        &lt;h2&gt;Lorem ipsum dolor sit amet 1&lt;\/h2&gt;\r\n      &lt;\/div&gt;\r\n      &lt;div class=\"accordion-body\"&gt;\r\n        &lt;p&gt;1 Lorem ipsum dolor sit amet, consectetur adipiscing 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.&lt;\/p&gt;\r\n      &lt;\/div&gt;\r\n    &lt;\/div&gt;\r\n    &lt;div class=\"accordion-item\"&gt;\r\n      &lt;div class=\"accordion-header\"&gt;\r\n        &lt;h2&gt;Lorem ipsum dolor sit amet 2&lt;\/h2&gt;\r\n      &lt;\/div&gt;\r\n      &lt;div class=\"accordion-body\"&gt;\r\n        &lt;p&gt;2 Lorem ipsum dolor sit amet, consectetur adipiscing 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.&lt;\/p&gt;\r\n      &lt;\/div&gt;\r\n    &lt;\/div&gt;\r\n    &lt;div class=\"accordion-item\"&gt;\r\n      &lt;div class=\"accordion-header\"&gt;\r\n        &lt;h2&gt;Lorem ipsum dolor sit amet 3&lt;\/h2&gt;\r\n      &lt;\/div&gt;\r\n      &lt;div class=\"accordion-body\"&gt;\r\n        &lt;p&gt;3 Lorem ipsum dolor sit amet, consectetur adipiscing 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.&lt;\/p&gt;\r\n      &lt;\/div&gt;\r\n    &lt;\/div&gt;\r\n  &lt;\/div&gt;\r\n\r\n&lt;\/main&gt;<\/pre>\n<p>Make sure to customize the section headers and content according to your needs.<\/p>\n<p>3. The following CSS code offers a basic style for your collapsible content. You can import it or integrate it into your existing CSS file. Feel free to modify the styles to match your website&#8217;s design.<\/p>\n<pre class=\"prettyprint linenums lang-css\">@import url(\"https:\/\/fonts.googleapis.com\/css?family=Roboto:400,500\");\r\n* {\r\n  box-sizing: border-box;\r\n}\r\n\r\nbody, html {\r\n  width: 100%;\r\n  height: 100%;\r\n  font-family: \"Roboto\", sans-serif;\r\n}\r\n\r\nmain {\r\n  min-height: 100%;\r\n  display: flex;\r\n  justify-content: center;\r\n  background: #2b42b6 !important;\r\n  padding: 150px 30px;\r\n}\r\n\r\n.accordion {\r\n  max-width: 550px;\r\n}\r\n.accordion-item {\r\n  background-color: transparent;\r\n  margin-bottom: 15px;\r\n  border-radius: 5px;\r\n  box-shadow: 0 2px 9px 0 rgba(0, 0, 0, 0.1);\r\n  transition: background-color 0.2s ease-in 0.3s;\r\n}\r\n.accordion-item.active {\r\n  background-color: white;\r\n  transition: background-color 0.2s ease-in 0s;\r\n}\r\n.accordion-item.active .accordion-header {\r\n  color: black;\r\n  background-color: white;\r\n  transition: background-color 0.2s ease-in 0s, color 0.2s ease-in 0.2s;\r\n}\r\n.accordion-item.active .accordion-header h2:before, .accordion-item.active .accordion-header h2:after {\r\n  background-color: black;\r\n  transition: background-color 0.2s ease-in 0.2s, transform 0.2s ease 0.1s;\r\n}\r\n.accordion-item.active .accordion-header h2:before {\r\n  display: none;\r\n}\r\n.accordion-item.active .accordion-header h2:after {\r\n  transform: rotate(90deg);\r\n}\r\n.accordion-item.active .accordion-body {\r\n  max-height: 900px;\r\n  padding: 0 15px 15px;\r\n  transition: max-height 0.3s ease-in 0s, padding 0.2s ease-in 0s;\r\n}\r\n.accordion-item.active .accordion-body p {\r\n  opacity: 1;\r\n  transition: opacity 0.2s ease-in 0.2s;\r\n}\r\n.accordion-header {\r\n  color: white;\r\n  background-color: #566cd7;\r\n  border-radius: 5px;\r\n  padding: 25px 15px;\r\n  cursor: pointer;\r\n  transition: background-color 0.2s ease-out 0.3s, color 0.2s ease-out 0s;\r\n}\r\n.accordion-header h2 {\r\n  position: relative;\r\n  font-size: 1rem;\r\n  font-weight: 500;\r\n  letter-spacing: 0.025em;\r\n  margin: 0;\r\n}\r\n.accordion-header h2:before, .accordion-header h2:after {\r\n  content: \"\";\r\n  position: absolute;\r\n  background-color: white;\r\n  transition: background-color 0.2s ease-in 0s, transform 0.2s ease 0s;\r\n}\r\n.accordion-header h2:before {\r\n  width: 10px;\r\n  height: 2px;\r\n  right: 0;\r\n  top: calc(50% - 1px);\r\n}\r\n.accordion-header h2:after {\r\n  width: 2px;\r\n  height: 10px;\r\n  right: 4px;\r\n  top: calc(50% - 5px);\r\n  transform: none;\r\n}\r\n.accordion-body {\r\n  max-height: 0;\r\n  padding: 0 15px;\r\n  overflow: hidden;\r\n  transition: max-height 0.2s ease-out 0s, padding 0.1s ease-out 0.2s;\r\n}\r\n.accordion-body p {\r\n  font-size: 0.875rem;\r\n  line-height: 1.6;\r\n  opacity: 0;\r\n  margin: 0;\r\n  transition: opacity 0.2s ease-in 0s;\r\n}\r\n\r\n.credits {\r\n  position: absolute;\r\n  bottom: 30px;\r\n  right: 30px;\r\n  font-size: 14px;\r\n}\r\n.credits p {\r\n  color: #94a2e6;\r\n  margin: 0;\r\n}\r\n.credits a {\r\n  color: white;\r\n}<\/pre>\n<p>4. The JavaScript code is responsible for making the content collapsible. It does this by adding and removing the &#8216;active&#8217; class to the accordion sections when the user clicks on the headers. Include the following code in your HTML file:<\/p>\n<pre class=\"prettyprint linenums lang-js\">const accordionItem = document.querySelectorAll('.accordion-item');\r\n                             \r\nconst onClickAccordionHeader = e =&gt; {\r\n  if (e.currentTarget.parentNode.classList.contains('active')) {\r\n    e.currentTarget.parentNode.classList.remove(\"active\");\r\n  } else {\r\n    Array.prototype.forEach.call(accordionItem, e =&gt; e.classList.remove('active'));\r\n    e.currentTarget.parentNode.classList.add(\"active\");\r\n  }\r\n};\r\n\r\nconst init = () =&gt; {\r\n  Array.prototype.forEach.call(accordionItem, e =&gt; e.querySelector('.accordion-header').addEventListener('click', onClickAccordionHeader, false));\r\n};\r\n\r\ndocument.addEventListener('DOMContentLoaded', init);<\/pre>\n<p>That&#8217;s all! hopefully, you have successfully created a Collapsible Content section on your website using this HTML, CSS, and JavaScript code. If you have any questions or suggestions, feel free to comment below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This JavaScript code provides an interactive way to create collapsible content sections on your web page. It works by allowing&#8230;<\/p>\n","protected":false},"author":1,"featured_media":9474,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[61],"tags":[],"class_list":["post-9464","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-accordion"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>JavaScript Code For Collapsible Content &#8212; CodeHim<\/title>\n<meta name=\"description\" content=\"Here is a free code snippet to create a JavaScript Code For Collapsible Content. You can view demo and download the source code.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/codehim.com\/accordion\/javascript-code-for-collapsible-content\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JavaScript Code For Collapsible Content &#8212; CodeHim\" \/>\n<meta property=\"og:description\" content=\"Here is a free code snippet to create a JavaScript Code For Collapsible Content. You can view demo and download the source code.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/codehim.com\/accordion\/javascript-code-for-collapsible-content\/\" \/>\n<meta property=\"og:site_name\" content=\"CodeHim\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/codehimofficial\" \/>\n<meta property=\"article:published_time\" content=\"2024-01-09T18:03:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-22T11:04:57+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/JavaScript-Code-For-Collapsible-Content.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"960\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Asif Mughal\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@CodeHimOfficial\" \/>\n<meta name=\"twitter:site\" content=\"@CodeHimOfficial\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Asif Mughal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/codehim.com\/accordion\/javascript-code-for-collapsible-content\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/codehim.com\/accordion\/javascript-code-for-collapsible-content\/\"},\"author\":{\"name\":\"Asif Mughal\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed\"},\"headline\":\"JavaScript Code For Collapsible Content\",\"datePublished\":\"2024-01-09T18:03:00+00:00\",\"dateModified\":\"2024-01-22T11:04:57+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/codehim.com\/accordion\/javascript-code-for-collapsible-content\/\"},\"wordCount\":229,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/codehim.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/accordion\/javascript-code-for-collapsible-content\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/JavaScript-Code-For-Collapsible-Content.png\",\"articleSection\":[\"Accordion\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/codehim.com\/accordion\/javascript-code-for-collapsible-content\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/codehim.com\/accordion\/javascript-code-for-collapsible-content\/\",\"url\":\"https:\/\/codehim.com\/accordion\/javascript-code-for-collapsible-content\/\",\"name\":\"JavaScript Code For Collapsible Content &#8212; CodeHim\",\"isPartOf\":{\"@id\":\"https:\/\/codehim.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/codehim.com\/accordion\/javascript-code-for-collapsible-content\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/accordion\/javascript-code-for-collapsible-content\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/JavaScript-Code-For-Collapsible-Content.png\",\"datePublished\":\"2024-01-09T18:03:00+00:00\",\"dateModified\":\"2024-01-22T11:04:57+00:00\",\"description\":\"Here is a free code snippet to create a JavaScript Code For Collapsible Content. You can view demo and download the source code.\",\"breadcrumb\":{\"@id\":\"https:\/\/codehim.com\/accordion\/javascript-code-for-collapsible-content\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/codehim.com\/accordion\/javascript-code-for-collapsible-content\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codehim.com\/accordion\/javascript-code-for-collapsible-content\/#primaryimage\",\"url\":\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/JavaScript-Code-For-Collapsible-Content.png\",\"contentUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/JavaScript-Code-For-Collapsible-Content.png\",\"width\":1280,\"height\":960,\"caption\":\"JavaScript Code For Collapsible Content\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/codehim.com\/accordion\/javascript-code-for-collapsible-content\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/codehim.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Accordion\",\"item\":\"https:\/\/codehim.com\/category\/accordion\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"JavaScript Code For Collapsible Content\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/codehim.com\/#website\",\"url\":\"https:\/\/codehim.com\/\",\"name\":\"CodeHim\",\"description\":\"Web Design Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/codehim.com\/#organization\"},\"alternateName\":\"Web Design Codes\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/codehim.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/codehim.com\/#organization\",\"name\":\"CodeHim - Web Design Code & Scripts\",\"url\":\"https:\/\/codehim.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/logo\/image\/\",\"url\":\"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg\",\"contentUrl\":\"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg\",\"width\":280,\"height\":280,\"caption\":\"CodeHim - Web Design Code & Scripts\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/codehimofficial\",\"https:\/\/x.com\/CodeHimOfficial\",\"https:\/\/www.instagram.com\/codehim\/\",\"https:\/\/www.linkedin.com\/company\/codehim\",\"https:\/\/co.pinterest.com\/codehim\/\",\"https:\/\/www.youtube.com\/@codehim\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed\",\"name\":\"Asif Mughal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g\",\"caption\":\"Asif Mughal\"},\"description\":\"I code and create web elements for amazing people around the world. I like work with new people. New people new Experiences. I truly enjoy what I'm doing, which makes me more passionate about web development and coding. I am always ready to do challenging tasks whether it is about creating a custom CMS from scratch or customizing an existing system.\",\"sameAs\":[\"https:\/\/codehim.com\"],\"url\":\"https:\/\/codehim.com\/author\/asif-mughal\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"JavaScript Code For Collapsible Content &#8212; CodeHim","description":"Here is a free code snippet to create a JavaScript Code For Collapsible Content. You can view demo and download the source code.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/codehim.com\/accordion\/javascript-code-for-collapsible-content\/","og_locale":"en_US","og_type":"article","og_title":"JavaScript Code For Collapsible Content &#8212; CodeHim","og_description":"Here is a free code snippet to create a JavaScript Code For Collapsible Content. You can view demo and download the source code.","og_url":"https:\/\/codehim.com\/accordion\/javascript-code-for-collapsible-content\/","og_site_name":"CodeHim","article_publisher":"https:\/\/www.facebook.com\/codehimofficial","article_published_time":"2024-01-09T18:03:00+00:00","article_modified_time":"2024-01-22T11:04:57+00:00","og_image":[{"width":1280,"height":960,"url":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/JavaScript-Code-For-Collapsible-Content.png","type":"image\/png"}],"author":"Asif Mughal","twitter_card":"summary_large_image","twitter_creator":"@CodeHimOfficial","twitter_site":"@CodeHimOfficial","twitter_misc":{"Written by":"Asif Mughal","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/codehim.com\/accordion\/javascript-code-for-collapsible-content\/#article","isPartOf":{"@id":"https:\/\/codehim.com\/accordion\/javascript-code-for-collapsible-content\/"},"author":{"name":"Asif Mughal","@id":"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed"},"headline":"JavaScript Code For Collapsible Content","datePublished":"2024-01-09T18:03:00+00:00","dateModified":"2024-01-22T11:04:57+00:00","mainEntityOfPage":{"@id":"https:\/\/codehim.com\/accordion\/javascript-code-for-collapsible-content\/"},"wordCount":229,"commentCount":0,"publisher":{"@id":"https:\/\/codehim.com\/#organization"},"image":{"@id":"https:\/\/codehim.com\/accordion\/javascript-code-for-collapsible-content\/#primaryimage"},"thumbnailUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/JavaScript-Code-For-Collapsible-Content.png","articleSection":["Accordion"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/codehim.com\/accordion\/javascript-code-for-collapsible-content\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/codehim.com\/accordion\/javascript-code-for-collapsible-content\/","url":"https:\/\/codehim.com\/accordion\/javascript-code-for-collapsible-content\/","name":"JavaScript Code For Collapsible Content &#8212; CodeHim","isPartOf":{"@id":"https:\/\/codehim.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/codehim.com\/accordion\/javascript-code-for-collapsible-content\/#primaryimage"},"image":{"@id":"https:\/\/codehim.com\/accordion\/javascript-code-for-collapsible-content\/#primaryimage"},"thumbnailUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/JavaScript-Code-For-Collapsible-Content.png","datePublished":"2024-01-09T18:03:00+00:00","dateModified":"2024-01-22T11:04:57+00:00","description":"Here is a free code snippet to create a JavaScript Code For Collapsible Content. You can view demo and download the source code.","breadcrumb":{"@id":"https:\/\/codehim.com\/accordion\/javascript-code-for-collapsible-content\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/codehim.com\/accordion\/javascript-code-for-collapsible-content\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codehim.com\/accordion\/javascript-code-for-collapsible-content\/#primaryimage","url":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/JavaScript-Code-For-Collapsible-Content.png","contentUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/JavaScript-Code-For-Collapsible-Content.png","width":1280,"height":960,"caption":"JavaScript Code For Collapsible Content"},{"@type":"BreadcrumbList","@id":"https:\/\/codehim.com\/accordion\/javascript-code-for-collapsible-content\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/codehim.com\/"},{"@type":"ListItem","position":2,"name":"Accordion","item":"https:\/\/codehim.com\/category\/accordion\/"},{"@type":"ListItem","position":3,"name":"JavaScript Code For Collapsible Content"}]},{"@type":"WebSite","@id":"https:\/\/codehim.com\/#website","url":"https:\/\/codehim.com\/","name":"CodeHim","description":"Web Design Code Snippets","publisher":{"@id":"https:\/\/codehim.com\/#organization"},"alternateName":"Web Design Codes","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/codehim.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/codehim.com\/#organization","name":"CodeHim - Web Design Code & Scripts","url":"https:\/\/codehim.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codehim.com\/#\/schema\/logo\/image\/","url":"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg","contentUrl":"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg","width":280,"height":280,"caption":"CodeHim - Web Design Code & Scripts"},"image":{"@id":"https:\/\/codehim.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/codehimofficial","https:\/\/x.com\/CodeHimOfficial","https:\/\/www.instagram.com\/codehim\/","https:\/\/www.linkedin.com\/company\/codehim","https:\/\/co.pinterest.com\/codehim\/","https:\/\/www.youtube.com\/@codehim"]},{"@type":"Person","@id":"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed","name":"Asif Mughal","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codehim.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g","caption":"Asif Mughal"},"description":"I code and create web elements for amazing people around the world. I like work with new people. New people new Experiences. I truly enjoy what I'm doing, which makes me more passionate about web development and coding. I am always ready to do challenging tasks whether it is about creating a custom CMS from scratch or customizing an existing system.","sameAs":["https:\/\/codehim.com"],"url":"https:\/\/codehim.com\/author\/asif-mughal\/"}]}},"views":1745,"_links":{"self":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts\/9464","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/comments?post=9464"}],"version-history":[{"count":0,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts\/9464\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/media\/9474"}],"wp:attachment":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/media?parent=9464"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/categories?post=9464"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/tags?post=9464"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}