{"id":6662,"date":"2011-03-17T02:46:34","date_gmt":"2011-03-17T06:46:34","guid":{"rendered":"http:\/\/info.template-help.com\/?p=6662"},"modified":"2015-09-11T05:15:29","modified_gmt":"2015-09-11T09:15:29","slug":"collapsing-site-navigation","status":"publish","type":"post","link":"https:\/\/www.templatemonster.com\/help\/collapsing-site-navigation.html","title":{"rendered":"&#8220;Collapsing Site Navigation&#8221;"},"content":{"rendered":"A collapsing menu contains vertical navigation bars and a slide out content area. When hovering over a menu item, an image slides down from the top and a submenu slides up from the bottom. Clicking on one of the submenu items will make the whole menu collapse like a card deck and the respective content area will slide out.\r\n\r\nJavaScript\r\nWe should include jQuery framework and collapsing-site-navigation.js by pointing src attribute in the script tag to the .js files\r\n\r\n<pre class=\"brush:js\">\r\n&lt;script type=\"text\/javascript\" src=\"jquery-1.4.2.min.js\">&lt;\/script>\r\n&lt;script type=\"text\/javascript\" src=\"collapsing-site-navigation.js\">&lt;\/script>\r\n<\/pre>\r\n\r\nThe <head> section of the index-#.html file contains these lines of code that initialize the script functionality with basic values:\r\n\r\n<p>&nbsp;<\/p>\r\n<h3>HTML<\/h3>\r\nOur HTML will consist of a main container with the class and id cc_menu. Here we will place all our vertical menu items and the main content div:\r\n\r\n<pre class=\"brush:css\">\r\n<div style=\"z-index:5;\">\r\n   <div>\r\n      &lt;img scr=\"images\/img1.jpg\" alt=\"\" \/>\r\n      <span class=\"cc_title\">Main page<\/span>\r\n      <span class=\"cc_submenu\">Main page <span>welcome to&nbsp; our site<\/span><\/span>\r\n   <\/div>\r\n<\/div>\r\n<div style=\"z-index:4;\">\r\n   <div>\r\n      &lt;img scr=\"images\/img2.jpg\" alt=\"\" \/>\r\n      <span class=\"cc_title\">about us<\/span>\r\n      <span class=\"cc_submenu\">about us<span>who we are<\/span><\/span>\r\n  <\/div>\r\n<\/div>\r\n<div style=\"z-index:3;\">\r\n   <div>\r\n      &lt;img scr=\"images\/img3.jpg\" alt=\"\" \/>\r\n      <span class=\"cc_title\">services<\/span>\r\n      <span class=\"cc_submenu\">services <span>&amp; solutions<\/span><\/span>\r\n   <\/div>\r\n<\/div>\r\n<div style=\"z-index:2;\">\r\n   <div>\r\n      &lt;img scr=\"images\/img4.jpg\" alt=\"\" \/>\r\n      <span class=\"cc_title\">partners<\/span>\r\n      <span class=\"cc_submenu\">partners <span>parnters list<\/span><\/span>\r\n   <\/div>\r\n<\/div>\r\n<div style=\"z-index:1;\">\r\n   <div>\r\n      &lt;img scr=\"images\/img5.jpg\" alt=\"\" \/>\r\n      <span class=\"cc_title\">locations<\/span>\r\n      <span class=\"cc_submenu\">locations <span>our contacts<\/span><\/span>\r\n   <\/div>\r\n<\/div>\r\n<\/pre>\r\n\r\nThe first item will get a z-index of 5 and then we will decrease the z-index for the next items. This will make the last item be in the lowest layer. We do this in order to create the card deck collapsing effect.\r\n\r\nNext goes the content of the pages:\r\n\r\n<pre class=\"brush:html\">\r\n<div id=\"cc_content\" class=\"cc_content\">\r\n        <section class=\"cc_content_1\">\r\n            ..............<!\u2014some content here-->\r\n        <\/section>\r\n        <section class=\"cc_content_2\">\r\n            ..............<!-- some content here -->\r\n        <\/section>\r\n        <section class=\"cc_content_3\">\r\n            ..............<!-- some content here -->\r\n        <\/section>\r\n        ........\r\n        <section class=\"privacy\">\r\n            ..............<!-- some content here -->\r\n        <\/section>\r\n        <section class=\"read_more\">\r\n            ..............<!-- some content here -->\r\n        <\/section>\r\n<\/div>\r\n<span id=\"cc_back\" class=\"cc_back\">back to menu<\/span>\r\n<span id=\"cc_back\" class=\"cc_back_page\">back to page<\/span>\r\n<a href=\"#\" id=\"privacy\">Privacy policy<\/a>\r\n<\/pre>\r\n\r\n\r\n<p>&nbsp;<\/p>\r\n<h3>CSS<\/h3>\r\n\r\n\r\n<pre class=\"brush:css\">\r\n.cc_menu {\r\nwidth:979px;\r\nheight:591px;\r\nposition: absolute;\r\noverflow:hidden\r\n}\r\n.cc_item{\r\ntext-align:center;\r\nwidth:195px;\r\nheight:591px;\r\nfloat:left;\r\nbackground:#171717;\r\nposition:relative;\r\nmargin-right:1px;\r\n}\r\nspan.cc_title{\r\ncolor:#fff;\r\nline-height:46px;\r\nfont-size:30px;\r\ntop:224px;\r\nleft:14px;\r\nposition:absolute;\r\nbackground:#272727;\r\nwidth:167px;\r\ndisplay:block;\r\nz-index:11;\r\n}\r\n.cc_item div{\r\ncursor:pointer\r\n}\r\n.cc_submenu{\r\ndisplay:block;\r\nwidth:163px;\r\nmargin:0;\r\npadding:0;\r\nheight:0px;\r\noverflow:hidden;\r\ntext-align:left;\r\nposition:absolute;\r\nleft:0px;\r\nbottom:-32px;\r\nbackground:url(..\/images\/bg_opacity.png) repeat;z-index:13;\r\n}\r\n.cc_submenu{\r\ncolor:#fff;\r\nfont-size:30px;\r\ncursor:pointer;\r\npadding:16px;\r\nline-height:44px;\r\ntext-transform:uppercase\r\n}\r\n.cc_submenu span{\r\ndisplay:block;\r\nfont-size:20px;\r\ncolor:#c5c5c5;\r\nline-height:26px;\r\npadding-top:8px;\r\n}\r\n.cc_item img{\r\nposition:absolute;\r\nwidth:195px;\r\nheight:591px;\r\ntop:-591px;\r\nleft:0px;\r\n}\r\n.cc_content{\r\nwidth:783px;\r\nheight:591px;\r\nposition:absolute;\r\nleft:-800px;\r\nbackground:#171717;\r\noverflow:hidden;\r\n}\r\n.cc_content section{\r\nwidth:100%;\r\ntext-transform:none;\r\nfont-size:12px;\r\nline-height:18px;\r\ndisplay:none\r\n}\r\nspan.cc_back, .cc_back_page{\r\nposition:absolute;\r\ntop:11px;\r\nright:-140px;\r\ncursor:pointer;\r\nfont:14px Arial, Helvetica, sans-serif; color:#171717;\r\nline-height:35px;\r\ntext-transform:uppercase;\r\npadding:0 18px;\r\nbackground:#feb400;\r\n}\r\n.privacy, .read_more{\r\nwidth:887px;\r\nposition:absolute;\r\nright:-980px; top:0;\r\nbackground:#171717;\r\nz-index:20;\r\npadding:0 46px;\r\n}\r\n.read_more{\r\nz-index:19\r\n}\r\n<\/pre>","protected":false},"excerpt":{"rendered":"<p>A collapsing menu contains vertical navigation bars and a slide out content area. When hovering over a menu item, an image slides down from the top and a submenu slides up from the bottom. Clicking on one of the submenu items will make the whole menu collapse like a card deck and the respective content [&hellip;]<\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[265,270],"tags":[815,794,813,571,634],"_links":{"self":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/6662"}],"collection":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/comments?post=6662"}],"version-history":[{"count":0,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/6662\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media?parent=6662"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/categories?post=6662"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/tags?post=6662"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}