March 28, 201412 yr Hello, I am a real amature at web design and I have a problem of trying to get a menu to work for me. It is a purchased template. The code allows you to see the "currect page item" and I can add this without a problem, but when I try and add a sub menu it all screws up. Below is a typicle code for the menu, It is hosted at this address www.first-forward.com User: Help Password: password100 <!-- Nav --> <nav id="nav" class="mobileUI-site-nav"> <ul><li class="current_page_item"> <a href="red/html/index.html">Home</a></li> <li> <span class="submenu">Dropdown</span> <ul> <li><a href="#">Lorem ipsum dolor</a></li> <li><a href="#">Magna phasellus</a></li> <li><a href="#">Etiam dolore nisl</a></li> <li> <span class="submenu">Phasellus consequat</span> <ul> <li><a href="#">Lorem ipsum dolor</a></li> <li><a href="#">Phasellus consequat</a></li> <li><a href="#">Magna phasellus</a></li> <li><a href="#">Etiam dolore nisl</a></li> <li><a href="#">Veroeros feugiat</a></li> </ul> </li> <li><a href="#">Veroeros feugiat</a></li> </ul> </li> <li> <a href="red/html/right-sidebar.html">Right Sidebar</a></li> <li> <a href="red/html/left-sidebar.html">Left Sidebar</a></li> <li> <a href="red/html/no-sidebar.html">No Sidebar</a></li> </ul> </nav> </header> </div> </div> </div> </div>
March 28, 201412 yr Hello, I am a real amature at web design and I have a problem of trying to get a menu to work for me. It is a purchased template. The code allows you to see the "currect page item" and I can add this without a problem, but when I try and add a sub menu it all screws up. Below is a typicle code for the menu, It is hosted at this address www.first-forward.com User: Help Password: password100 <!-- Nav --> <nav id="nav" class="mobileUI-site-nav"> <ul> <li class="current_page_item"> <a href="red/html/index.html">Home</a></li> <li> <span class="submenu">Dropdown</span> <ul> <li><a href="#">Lorem ipsum dolor</a></li> <li><a href="#">Magna phasellus</a></li> <li><a href="#">Etiam dolore nisl</a></li> <li> <span class="submenu">Phasellus consequat</span> <ul> <li><a href="#">Lorem ipsum dolor</a></li> <li><a href="#">Phasellus consequat</a></li> <li><a href="#">Magna phasellus</a></li> <li><a href="#">Etiam dolore nisl</a></li> <li><a href="#">Veroeros feugiat</a></li> </ul> </li> <li><a href="#">Veroeros feugiat</a></li> </ul> </li> <li> <a href="red/html/right-sidebar.html">Right Sidebar</a></li> <li> <a href="red/html/left-sidebar.html">Left Sidebar</a></li> <li> <a href="red/html/no-sidebar.html">No Sidebar</a></li> </ul> </nav> </header> </div> </div> </div> </div> What are you trying to achieve? Is this wordpress?
March 28, 201412 yr Author No its not wordpress, the template came with a built in menu, and the menu indicates what page you are on in relation to the menu. So if you are on the home page there is a small red graphic above the home page wording. If you look at the web site next to home on the menu is "drop down" with a drop down menu. If a page is linked to any "drop down" on that drop down menu, when you arrive at that page the red graphic should now be placed above "drop down" on the menu offered to indicate where you are on the site. There lies my problem, the template builder never programmed it with an example of it working with a sub menu, they only programmed it with single menu items as shown on another menu item for example right or left sidebar menu option. If you click on these the page it takes you to shows where you are by placing the red graphic above whichever menu choice you clicked. I can produce that but I cannot get it to work by navigation with a sub menu. I can construct a sub menu etc but the red graphic is missing. www.first-forward.com User: Help Password: password100
March 28, 201412 yr Firstly your issue can be solved with jquery and css, this is what I use, jquery adds a current class to the link containing the current page then you use css to recreate the red graphic <script type="text/javascript"> $(function(){ $('a').each(function() { if ($(this).prop('href') == window.location.href) { $(this).addClass('current'); } }); }); </script>
March 28, 201412 yr Author Firstly your issue can be solved with jquery and css, this is what I use, jquery adds a current class to the link containing the current page then you use css to recreate the red graphic <script type="text/javascript"> $(function(){ $('a').each(function() { if ($(this).prop('href') == window.location.href) { $(this).addClass('current'); } }); }); </script> Thank you for coming back to me on this, much appreciated. I understand how it works in principle but to be honest its above me to do even that. This is my first attenpt at web design and I would not know what to do. This is my existing CSS that I believe relates to the Nav:How to connect these up to make it work is beyond me, I thought it was a case of tweeking the existing code! /*********************************************************************************/ /* Nav */ /*********************************************************************************/ #nav { overflow: hidden; position: absolute; right: 0; top: 0; } #nav ul { } #nav li { display: block; float: left; margin: 0 0 0 1.75em; height: 6.2em; line-height: 6.2em; } #nav a, #nav span { display: block; padding: 0 1em 0 1em; text-decoration: none; color: #cacaca; text-transform: uppercase; font-weight: 700; font-size: 1.0em; border-top: 6px solid transparent; outline: 0; } #nav li.current_page_item a { border-top-color: #cb354e; } #nav li.current_page_item a, #nav li.active a, #nav li.active span, #nav li:hover a, #nav li:hover span { color: #272727; } #nav ul > li > ul { display: none; } .dropotron { background: #cb354e; padding: 1.35em 0 1.35em 0; min-width: 13.5em; box-shadow: 0px 4px 8px 0px rgba(0,0,0,0.15); } .dropotron-level-0 { margin-left: 0em; } .dropotron-level-0:after { content: ''; display: inline-block; position: absolute; top: -12px; left: 16px; border-left: solid 12px transparent; border-right: solid 12px transparent; border-bottom: solid 12px #cb354e; } .dropotron a, .dropotron span { display: block; color: #fff; opacity: 0.75; text-decoration: none; line-height: 2em; padding: 0 1.5em 0 1.5em; } .dropotron li:hover > a, .dropotron li:hover > span { opacity: 1.0; }
Create an account or sign in to comment