How to Create Two Columns in Dropdown Menu - php

I want to add a second column for the items in the dropdown menu here http://www.kingadlerhomedecor.com/store/ I have a big list of items which are to be added to the category 'MEBLE' but I cannot have a really long list when there is just one column, if the list could split into two columns, i will be sorted. Please help.
/* MENU */
.primary-define #menu {
text-align: left;
font-family: helvetica, Arial;
/*background-color: #999;*/
}
.primary-define #menu-inner {
position: relative;
font-family: helvetica, Arial;
background-color: #999; /*No color was added origninally - added to make it grey*/
}
.primary-define .mainmenu {
margin: 0;
padding: 0;
position: relative;
list-style-type: none;
}
.primary-define .mainmenu li {
margin: 0;
padding: 0;
position: relative;
}
.primary-define .mainmenu > li {
float: left;
/*background-color: #999;*/
}
.primary-define .mainmenu li a {
color: #666; /*originial #666*/
display: block;
font-size: 10px; /*original 15px */
padding: 0.5px 1px; /*20px 25px */ /*Padding for the dropdown elements*/
text-decoration: none;
/*background-color: #999;*/
}
.primary-define .mainmenu > li > a {
color: #fff;
padding: 15px 25px; /*35px*/
font-size: 14px; /*original 18px */
font-weight: 600;
line-height: 100%;
font-family: helvetica, Arial;
}
.primary-define .mainmenu > li:hover > a,
.primary-define .mainmenu > li.active > a {
background-color: rgba(0, 0, 0, 1); /*rgba(0, 0, 0, 0.2)*/
/*font-size: 15px;*/
}
.primary-define .mainmenu li .dropdown-container {
top: 99%;
overflow: hidden;
position: absolute; /*absolute*/
padding-left: 1px; /*added by yuvi*/
font-size: 30px; /*added by yuvi*/
}
.primary-define .mainmenu li .dropdown {
margin-top: -300px; /*-999px*/
background-color: #fff;
border-left: 1px solid #eee;
border-bottom: 1px solid #eee;
font-size: 30px; /*added by yuvi*/
padding: 10px;
}
.primary-define .mainmenu li:hover .dropdown {
margin-top: 0;
/*font-size: 30px; added by yuvi*/
}
}
.primary-define .mainmenu ul {
margin: 0;
float: left;
width: auto; /*249px*/
list-style-type: none;
border-right: 1px solid #eee;
}
.primary-define .mainmenu ul li:hover a,
.primary-define .mainmenu ul li.active a {
background-color: #eee; /*orginiarl #eee*/

First, it looks like you would need to widen the .dropdown element. Currently there is an inline style of width:300px. I would either increase that (500px looked good to me) to make room for 2 columns or remove the inline style and add it to the stylesheet (<- recommended).
From there you can set the width of the ul elements to half the width of the dropdown and float them.
.primary-define .mainmenu li .dropdown ul {
width: 50%;
float: left;
list-style: none; #This is to remove the circle next to the list items
}

Related

Form outside table php

I have a problem with mapping together table and form. In my table I have some values that with help of a form I want to redirect to a page.I have read that I cannot put a form into a table so I tried not to. But if I let
<form>
<table>
structure, my display on page isn't very nice and I am not responsabile with frontend part but anyway I want to not be problems with it.If I let the table, without the form the display is ok(like in image). An image in left page and the table with the information in the right part. When using form, the table goes down and it's not good. So how to do? I try to include an image here to see how my page looks like without the form, but I really need to use the form. Any suggestion how to resolve this?I mean it's possible to have the display like in the photo but plus using a form and to not change the display?
EDIT: the css where tables are displayed
/* ==========================================================================
Tables
========================================================================== */
/*
* Remove most spacing between table cells.
*/
table {
border-collapse: collapse;
border-spacing: 0;
text-align: left;
}
table th {
padding-right: 40px;
}
html {overflow-y: scroll; overflow-x: hidden;}
body {font-family: 'Open Sans', sans-serif; background:#f0eeed; color: #676767;}
.wrapper {width: 980px; margin: 0 auto;}
#content {padding: 20px 0 80px;}
.header:after {content:"";height:0;display:block;visibility:hidden;clear:both;}
.header {background: #ef8887; border-bottom: 3px solid #db7a78;}
.header .branding-title {float: left; margin: 0 0 0 5px; font: 0/0 serif; text-shadow: none; color: transparent; width:225px; height:125px;background:url(../img/branding-title.png) 0 6px no-repeat;padding: 6px 0;}
.header .branding-title a {display: block; height: 125px; width: 225px;}
.header .nav {float: right; top: 10; right: 0; margin: 0; position: relative; left: 15px; z-index: 99999999;}
.header .nav li {display: inline-block; margin: 0; list-style: none;}
.header .nav li a {
color: white;
text-decoration: none;
display: block;
line-height: 95px;
padding: 10px 0 0;
margin: 0 0 0 50px;
width: 100px;
text-align: left;
background: url('../img/nav-sprite.png') no-repeat 0px 105px;
white-space: nowrap;
text-transform: uppercase;
letter-spacing: 1px;
}
.header .nav li.on a {text-decoration:underline;}
.header .nav li a:hover, .header .nav li a:active {opacity: 0.7;}
.header .nav li.books a {background-position: 8px -5px;}
.header .nav li.movies a {background-position: 13px -105px;}
.header .nav li.music a {background-position: 15px -235px;}
.header .nav li.suggest a {background-position: 35px -340px;}
#content {min-height: 400px; background: white;}
.section.page:after {content:"";display:block;visibility:hidden;height:0;clear:both;}
.section.page {padding: 34px 0; background: white;}
.section.page h1 {
font-size: 24px;
text-align: center;
line-height: 1.6;
font-weight: normal;
}
.section.page .media-details h1 {
text-align: left;
}
.section.page p {width: 475px; margin-left: auto; margin-right: auto; }
.section.page .media-details h1 .price {color: #9d9f4e; padding-right: 10px; font-size: 34px;}
.section.catalog {padding-bottom: 42px;}
.section.catalog h2 {
font-size: 24px;
text-align: center;
line-height: 1.6;
font-weight: normal;
padding-top: 20px;
}
.section.catalog ul.items {margin: 0 0 -17px 0; padding: 0; width: 997px;}
.section.catalog ul.items li {
display: inline-block;
list-style: none;
width: 204px;
text-align: center;
padding: 14px;
margin: 0 0 17px 17px;
position: relative;
left: -17px;
}
.section.catalog ul.items li a:hover:after {
content: '+';
font-size: 50px; position: absolute; top:35px; right:30px; color: #3888c2; vertical-align: top;
}
.section.catalog ul.items li a {
background: white;
display: block;
padding: 30px 0 10px;
text-decoration: none;
}
.details-button {
color: #888;
}
.section.catalog ul.items li a:hover {
opacity: 1;
color: #666;
}
.section.catalog ul.items li img {
width: 190px;
border: 6px solid #f0eeed;
}
.section.catalog ul.items li p {
margin-left: 0;
margin-right: 0;
width: auto;
}
.media-picture {
float: left;
width: 400px;
text-align: center;
border: 1px solid #d9d9d9;
padding: 14px;
background: #f0eeed;
}
.media-picture span {
background: white;
display: block;
width: 100%;
padding: 36px 0 61px;
}
.media-picture img {width: 292px;}
.media-details {
width: 460px;
float: right;
}
.media-details form {
margin-left: 0;
}
td, th {
padding: 5px 5px;
}
form {width: 475px; margin: 34px auto;}
form tr, tr {text-align:left;vertical-align: top; padding:2px;}
form table {width: 475px; margin-bottom: 16px;}
form th {
width: 150px;
vertical-align: middle;
padding: 8px;
}
form td {
padding: 15px 15px;
}
form td select,
form td input,
form td textarea {
width: 100%;
border-radius: 4px;
padding: 10px;
border: 1px solid #a5a5a5;
font-size: 14px;
font-family: 'Open Sans', sans-serif;
}
form input[type="submit"] {
width: 475px;
text-align: center;
border: 0;
background: #3888c2;
color: #FFF;
-webkit-border-radius: 4px;
border-radius: 4px;
font-size: 16px;
padding: 14px 0 16px;
font-family: 'Open Sans', sans-serif;
}
form input[type="submit"]:hover {
background: #358dce;
cursor: pointer;
}
.search {
background: #f0eeed;
border-bottom: 3px solid #dddddd;
width:100%;
text-align:right;
}
.search form {
margin: 5px 5px 5px auto;
}
.search form input[type="submit"] {
width: auto;
text-align: center;
border: 0;
background: #3888c2;
color: #FFF;
-webkit-border-radius: 4px;
border-radius: 4px;
font-size: 16px;
padding: 6px;
font-family: 'Open Sans', sans-serif;
}
.page p.message {
background: #ffeca4;
border: 1px solid #f16702;
padding: 1em;
width: 444px;
}
.breadcrumbs {
font-size: 14px;
font-weight: normal;
padding: 14px 0 48px;
}
.breadcrumbs a {
text-decoration: none;
color: #3888c2;
}
.note-designer {
font-size: 14px;
font-style: italic;
font-weight: bold;
}
.footer {
background: #f0eeed;
border-top: 3px solid #dddddd;
padding: 42px 0;
font-size: 12px;
color: #a5a5a5;
}
.footer ul {margin: 0; padding: 0; float: left;}
.footer ul li {
margin: 0;
padding: 0;
list-style: none;
display: inline-block;
}
.footer ul li:after {content:" | "}
.footer ul li:last-child:after {content:"";}
.footer p {margin: 0; padding-right: 3px;}
.footer a {text-decoration: none; color: #539def; margin: 0 10px;}
.footer li:first-child a {margin-left: 4px;}
.footer a:hover, .footer a:active {text-decoration: underline;}
sorry for the long code but this is what I found in style css
As mentioned previously, avoid using tables for anything but actual tabular data. Using it to position elements on the page is unpredictable at best.
You said that you aren't responsible for the front end, but do you have access to the HTML? I'm sure many of us could give you some helpful suggestions but we need a reference point beyond a screenshot :).
You might want to check out how some CSS frameworks handle this, it might give you some inspiration (http://getbootstrap.com/css/#forms). I'm not a big Bootstrap guy but there are a lot of basic examples here on form / table formatting.
You should be able to put just about anything inside a form tag without affecting the way anything on the page looks. Assuming you can't just stop using tables asap, you may have to play around with the css to clean this up. If the form tag is affecting the way anything embedded inside it looks then you might have something in your CSS styling the form element. If possible I would eliminate this styling if it exists.

how to click event in css

This works:
.rightone ul {
list-style: none;
padding: 0px;
margin: 0px;
}
.rightone ul li {
display: block;
position: relative;
float:right;
}
.rightone li ul {
display: none;
}
.rightone ul li a {
display: block;
padding: 5px 30px 5px 30px;
text-decoration: none;
white-space: nowrap;
}
.rightone ul li li {
background-color: black;
border-radius:5px;
padding: 2%;
}
.rightone ul li a:hover {
color:#0ef2c4;
}
.rightone li:active ul {
display: block;
text-align: left;
position: absolute;
}
.rightone li:hover li {
float: none;
}
.rightone li:hover a {
color:#0ef2c4;
}
.rightone li:hover li a:hover {
color:white;
}
.arrow-down {
width: 0;
height: 0;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-top: 8px solid #0ef2c4;
cursor: pointer;
}
But it work only when i hold... but i need, if i single click show that pop-up again click that arrow it will hide..
My output
I want to move that pop up left side also..
I want like this
https://jsfiddle.net/z4fej7gm/
But i dont know how apply to my project
Please anyone help me.. Thanks in advance
Css doesn't support click events

Avada Theme - Submenu customization

I just started using the Avada Theme in my wordpress site. I need to customize the menu on the left hand side. The items in the submenu should be shown below the parent item, not on next to it. I started by using the side-navigation css styles, but I can't get the child items to work.
.side-nav {
list-style: none;
margin: 0;
padding: 0;
border-top: 1px solid #ededed;
margin-bottom: 20px;
}
.side-nav ul {
list-style: none;
margin: 0;
padding: 0;
}
.side-nav li {
margin: 0;
padding: 0;
}
.side-nav li a {
border-bottom: 1px solid #ededed;
display: block;
height: auto;
font-weight: normal;
font: 14px/39px 'MuseoSlab500Regular', arial, helvetica, sans-serif;
color: #333333;
}
.side-nav li a {
line-height: 1.69em;
padding: 8px 0;
}
.side-nav li a:hover {
background: none;
}
.side-nav li.current_page_item > a {
background: none;
color: #a0ce4e;
}
.side-nav li.current_page_item li a {
color: #333333;
border-bottom: 1px solid #ededed;
}
.side-nav .children {
display: none;
margin-left: 15px;
}
.side-nav .arrow {
display: inline;
margin-left: 0;
}
.side-nav .arrow:after {
position: absolute;
font-size: 14px;
font-family: IcoMoon;
}
.side-nav-left .side-nav {
border-right: 1px solid #ededed;
}
.side-nav-left .side-nav li.current_page_item > a {
border-right: 3px solid #a0ce4e;
}
.side-nav-left .side-nav .arrow {
margin-left: 10px;
}
.side-nav-left .side-nav .arrow:after {
content: '\f105';
}
.side-nav-right .side-nav {
border-left: 1px solid #ededed;
}
.side-nav-right .side-nav li.current_page_item > a {
padding-left: 23px;
border-left: 3px solid #a0ce4e;
}
.side-nav-right .side-nav li a {
padding-left: 25px;
}
.side-nav-right .side-nav .arrow {
margin-right: 10px;
}
.side-nav-right .side-nav .arrow:after {
content: '\f104';
}
.side-nav-right .side-nav .children {
margin-left: 40px;
}
.side-nav-right .side-nav .children a {
padding-left: 0;
}
For better understanding here is a screenshot of what I try to build.
The Image on the left shows the current style of the menu / submenu. The image on the right is showing the side-navigation template which comes with Avada. Out of the Box it's not possible to use the side-navigation style in the main menu. I already posted a question in the Theme-Fursion forum, but they were not able to help me. Maybe you can give me a hint.
Thank you
To achieve this effect you would have to change the positioning of the submenu list from absolute to relative, and adjust it a bit e.g. in this way:
body.side-header-left #side-header #nav > ul > li > ul.sub-menu {
position: relative;
right: auto;
left: auto;
top: auto;
visibility: visible;
opacity: 1;
width: 100%;
height: 0;
overflow:hidden;
}
body.side-header-left #side-header #nav > ul > li:hover > ul.sub-menu,
body.side-header-left #side-header #nav > ul > li.current_page_item > ul.sub-menu {
height: auto;
}

How do I get wp_nav_menu to stay expanded when I navigate to submenu items?

I am a new arrival in the Wordpress community and currently I am working on trying to convert a static HTML site over to the WP platform. I have almost everything in my theme working with one exception: the navigation menu.
I am trying to use the built in navigation functionality, and I am pretty sure I have seen this done on other WP sites, but I'm having a hard time finding help to guide me through this area (I apologize if there is already an ask for this scenario on stackoverflow, I've been searching for a few days now and maybe I'm just using the wrong terminology?).
This is my testing base: http://ahathaway.n120.fiercethought.net/consumer-support/
That link will take you to the only section on the website that is supposed to have a "sub-menu" and what I am trying to accomplish is having the submenu stay expanded if and when the user navigates to any of the sub-menu items (i.e. if you click "Membership Forms" the sub-menu shouldn't disappear as it does currently).
I'm not sure what I'm missing here exactly, and I'm in desperate need of a nudge in the correct direction, so any help at all is and will be much appreciated! Thanks!
Here is my relevant code (please let me know if you need/want to see anything else, I tried to keep this post concise, at least initially):
From header.php:
<!-- Begin navigation menu -->
<?php
// Top navigation menu
wp_nav_menu( array(
'theme_location' => 'top-navigation',
'menu_id' => 'nav',
'menu_class' => 'left',
'depth' => 2,
'walker' => new Walker_Nav_Menu));
?>
<!-- End navigation menu -->
Here is the style.css (since this is a conversion and needs to look as close to identical as possible, much of the CSS has been left intact:
/* The following is from the reset.css originally housed */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-weight: inherit;
font-style: inherit;
font-size: 100%;
font-family: inherit;
vertical-align: baseline;
}
/* remember to define focus styles! */
:focus {
outline: 0;
}
body {
line-height: 1;
color: black;
background: white;
}
ol, ul {
list-style: none;
}
/* tables still need 'cellspacing="0"' in the markup */
table {
border-collapse: separate;
border-spacing: 0;
}
caption, th, td {
text-align: left;
font-weight: normal;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: "";
}
blockquote, q {
quotes: "" "";
}
/* The following CSS came from screen.css from the original website */
body {background: #3279b3; color: #333; font: 13px/17px "Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;}
strong {font-weight: bold;}
p {margin: 10px 0;}
p.small {font-size: 11px; line-height: 14px; color: #666;}
label {font-weight: bold;}
input, textarea {margin: 5px 0 10px 0; font-family: "Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;}
textarea {width: 500px; height: 100px; font-size: 11px; padding: 5px;}
a {color: #738403; font-weight: bold;}
hr {margin: 20px 5px; border: none; border-bottom: 1px solid #bed6e9; clear: left;}
* + html hr{margin: 10px 5px 0 5px; padding: 0; border: none !important; line-height: 1px; color: #bed6e9;}
#wrapper {width: 100%; margin: 0 auto; background: url(/_assets/bg_body.png) top center repeat-y;}
#cols {width: 930px; margin: 0 auto; background: url(/_assets/bg_cols.png) 0 0 no-repeat; position: relative; overflow: auto; padding: 0 15px 10px 15px;}
#cols img.bnr {float: left; margin-bottom: 18px}
#topbar {height: 50px; width: 708px; position: absolute; top: 0; right: 14px;}
#topbar form {float: right; margin-top: 11px; background: url(/_assets/bg_search.png) 0 0 no-repeat; width: 175px; height: 28px;}
#topbar input {background: none; border: none; margin: 0;}
#topbar input.box {width: 130px; color: #c8e6ff; padding: 6px 0 6px 8px; font: 11px "Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; height: auto; line-height: 11px; vertical-align: top;}
#topbar input.button {
width: 34px;
height: 26px;
font-size: 1px;
text-indent: -999em;
cursor: pointer;
}
#weather {float: left; margin-top: 4px; font-size: 12px;}
#weather ul, #weather li {display: inline; line-height: 40px; color: #fff;}
#weather img {float: left; margin-right: 3px;}
#col_lft {width: 215px; float: left; background: url(/_assets/bg_nav.png) bottom center no-repeat;}
#nav {width: 215px;}
#nav li a, menu-item {color: #fff; font-size: 13px; text-decoration: none; height: 35px; line-height: 37px; width: 185px; padding: 0 15px; display: block; border-top: 1px solid #416788; border-bottom: 1px solid #17354e; font-weight: normal;}
#nav li a:hover, #nav li.current_page_item a, #nav li.parent-here a {color: #76d3ff; background: url(/_assets/bg_nav_hover.png) top center no-repeat; border-top: 1px solid #17354e;}
#nav li ul {display: none; margin: 0; padding: 0;}
#nav li ul li a {border: 0 !important;}
#nav li.current_page_item ul, #nav li.parent-here ul {display: inline !important;}
#nav li.current_page_item ul li a, #nav li.parent-here ul li a { color: #fff; font-size: 13px; font-weight: normal; text-transform: none; text-decoration: none; height: auto; line-height: 16px; width: 175px; display: block; padding: 10px 20px 0 20px; background-image: none !important; background-color: #082640 !important;}
#nav li ul li a:hover, #nav li ul li a:active, #nav li.parent-here ul li.current_page_item a { background-image: none !important; color: #259fd2; }
#nav li.last a, #nav li ul li.last a, #nav li ul li.herelast a {padding-bottom: 3px; border-bottom: none !important;}
#nav li ul li.last a {padding-bottom: 12px;}
#nav li.herelast a {background: url(/_assets/bg_nav_hover_bot.png) bottom center no-repeat; border: none !important; padding-top: 1px; padding-bottom: 3px;}
#nav li.last a:hover {background: url(/_assets/bg_nav_hover_bot.png) bottom center no-repeat;}
#nav li.herelast, #nav li.herelast a {color: #259fd2 !important;}
* + html #nav li ul {float: left; margin-left: -16px;}
#col_rht {width: 700px; float: right; margin-top: 65px;}
#col_rht h1 {font-size: 24px; font-weight: bold; color: #d87500; margin: 6px 5px 15px 5px; padding-bottom: 22px; line-height: 24px; border-bottom: 1px solid #88abc7;}
#col_rht h2 {font-size: 15px; line-height: 18px; font-weight: bold; margin: 20px 5px 10px 5px;}
#col_rht h3 {font-weight: bold; margin-top: 20px;}
#col_rht h3, #col_rht p, #col_rht ul, #col_rht ol, #col_rht table, #col_rht blockquote {margin: 10px 5px;}
#col_rht table {width: 690px;}
#col_rht table, td {border: 1px solid #b9d7ef; border-collapse: collapse;}
#col_rht td {padding: 6px 8px; line-height: 15px;}
#col_rht tr.odd {background: #dff1ff}
#col_rht ol li {
list-style: decimal;
margin-left: 20px;
margin-bottom: 5px;
}
#col_rht ul li {
list-style: disc;
margin-left: 20px;
margin-bottom: 5px;
}
#col_rht a {
color: #008ec9;
font-weight: bold;
}
#col_rht img.flt_lft {float: left; margin: 0px 15px 15px 5px;}
#col_rht img.flt_rht {float: right; margin: 5px 5px 15px 15px;}
#col_rht blockquote {background: #dff1ff; padding: 1px; border-left: 5px solid #82b0d4;}
#col_rht blockquote p {margin: 10px; padding: 0;}
#buckets {width: 700px; overflow: auto; background: url(/_assets/bg_buckets.png) 0 0 repeat-y; font-size: 12px;}
#buckets div.bucket {width: 202px; margin-right: 30px; float: left; padding: 0 5px; overflow:visible}
#buckets div.bucket.last {margin-right: 0; position:inherit}
#buckets h2 {font-size: 18px; font-weight: bold; color: #e07c06; margin: 0 0 12px 0; padding-bottom: 15px; line-height: 20px; border-bottom: 1px solid #bed6e9; line-height: 16px;}
#buckets h3 {font-weight: bold; margin: 10px 0;}
#buckets p {margin: 10px 0 0 0;}
#buckets label {margin-left: 10px;}
#buckets input {width: 195px;}
#buckets input.submit {margin-bottom: 0; width: 60px;}
#footer {width: 100%; height: 50px; margin: 0 auto; background: url(/_assets/bg_footer.png) bottom center no-repeat; padding-bottom: 40px;}
#footer p {margin: 0; padding: 15px 0 0 0; font-size: 11px; color: #666; line-height: 15px; text-align: center;}
there is a class called current_page_item which is responsible for the menu expansion. That class is present in li#menu-item-30 in the link you gave. However, current_page_item is absent and replaced by current_page_parent for the subpages. That's why it's not showing.
Therefore, what I recommend is that in your stylesheet, you duplicate every DOM identifier which uses current_page_item, and put current_page_parent in its place. Here is what I mean:
Before:
#nav li.current_page_item ul li a, #nav li.parent-here ul li a { color: #fff; font-size: 13px; font-weight: normal; text-transform: none; text-decoration: none; height: auto; line-height: 16px; width: 175px; display: block; padding: 10px 20px 0 20px; background-image: none !important; background-color: #082640 !important;}
After:
#nav li.current_page_parent ul li a, #nav li.current_page_item ul li a, #nav li.parent-here ul li a { color: #fff; font-size: 13px; font-weight: normal; text-transform: none; text-decoration: none; height: auto; line-height: 16px; width: 175px; display: block; padding: 10px 20px 0 20px; background-image: none !important; background-color: #082640 !important;}
Do that for every instance of current_page_item you find, and you should be good to go.
By the way, are you using Firebug or the Chrome/Safari Developer Tools? They are invaluable for debugging these types of problems. That's basically all I did. :)
I think you haven't mentioned any styling of the current class
current_page_item This is the class which keeps the menu open
In Css You can implement this styling:
#access {display: block; margin: 0 auto; width: 990px; z-index:999;}
#access .menu-header, div.menu {font-size: 13px; width:100%; float:left; height:42px; margin-top:10px; background:#F7F7F7;border:1px solid #e3e3e3; border-bottom:3px solid #e3e3e3;}
#access .menu-header ul, div.menu ul {list-style: none; margin: 0;}
#access .menu-header li, div.menu li {float: left; position: relative;padding-right:0px; z-index:9999;}
#access a {color: #fff; display: block; line-height: 35px; padding: 0 25px; text-decoration: none; font-size:14px;}
#access ul ul {display: none; position: absolute; top:42px; left:0px; float: left; width:170px; z-index: 999999999; background:#E3E3E3; padding:10px 6px 7px 10px;}
#access ul ul li {min-width:165px;}
#access ul ul ul {left: 100%; top: 0;}
#access ul ul a {line-height: 1em; padding:5px 10px; width:146px; height: auto; font-size:14px; text-transform:capitalize; margin-bottom:3px; background-color:#F7F7F7;}
.sub-menu li {background:none!important;}
/*.current_page_item > a{background-color:#BE100F; height:35px;}*/
.menu .sub-menu .current_page_item > a{background:none;}
.menu .current_page_item > a{background-color: #e3e3e3!important; color: #333 !important;}
.menu .current-menu-parent > a{background-color: #e3e3e3!important; color: #333 !important;}
#access ul ul :hover > a {background-color:#336699; color:#FFFFFF;}
#access ul li:hover > ul {display: block;}
In PHP:
<div id="access">
<?php
$args = array(
'theme_location' => 'header_menu',
'menu' => 'Main Menu',
'sort_column' => 'menu_order',
'container_class' => 'menu-header'
);
wp_nav_menu($args);
?>
</div>

My link is not working well using jquery

I have a link like this
<li><a class='myclass' href="<?php echo base_url();?>index.php/controller">Search</a></li>
and my jquery is
$("a.myclass").click(function(){
var link = $(this);
var url = link.attr("href");
$(".content").load(url);
return false;
});
actually it links correctly the problem is my list in my menu looks ugly not it looks it should be though other li looks ok. when i change to
<li><a class='.myclass.' href="<?php echo base_url();?>index.php/controller">Search</a></li>
it looks correctly but its not linking to anything.
What is the problem here?
Here is my css
.webwidget_vertical_menu {
float: left;
width: 20%;
background-color: #fff;
padding-bottom: 10px;
}
.webwidget_vertical_menu ul{
padding: 0.5px;
margin: 0px;
font-family: Arial, Helvetica, sans-serif;
}
.webwidget_vertical_menu li{
}
.webwidget_vertical_menu ul li{
list-style: none;
position: relative;
}
.webwidget_vertical_menu ul li a{
padding-left: 15px;
text-decoration: none;
}
.webwidget_vertical_menu ul li ul{
display: none;
position: absolute;
background-color: #fff;
z-index: 999999;
}
.webwidget_vertical_menu ul li ul li{
position: relative;
margin: 0px;
border:none;
}
.webwidget_vertical_menu ul li ul li ul{
}
.webwidget_vertical_menu_down_drop{
background-position: right center;
background-repeat:no-repeat !important;
}
.webwidget_vertical_menu ul li li{
font-weight: normal;
}
body {
font: 100%/1.4 Verdana, Arial, Helvetica, sans-serif;
background-color: #42413C;
margin: 0;
padding: 0;
color: #000;
}
ul, ol, dl {
padding: 0;
margin: 0;
}
h1, h2, h3, h4, h5, h6, p {
margin-top: 0;
padding-right: 15px;
padding-left: 15px;
}
a img {
border: none;
}
a:link {
color:#414958;
text-decoration: underline;
}
a:visited {
color: #4E5869;
text-decoration: underline;
}
a:hover, a:active, a:focus {
text-decoration: none;
}
.container {
width: 80%;
max-width: 1260px;
background: #FFF;
margin: 0 auto;
}
.header {
background-color: #ADB96E;
}
.sidebar1 {
float: left;
width: 20%;
background-color: #EADCAE;
padding-bottom: 10px;
}
.content {
padding: 10px 0;
width: 60%;
float: left;
}
.sidebar2 {
float: right;
width: 20%;
background-color: #EADCAE;
padding: 10px 0;
}
.content ul, .content ol {
padding: 0 15px 15px 40px; }
ul.nav {
list-style: none;
border-top: 1px solid #666;
margin-bottom: 15px;
}
ul.nav li {
border-bottom: 1px solid #666;
list-style: none;
position:relative;
}
ul.nav a, ul.nav a:visited {
padding: 5px 5px 5px 15px;
display: block;
text-decoration: none;
background-color: #C6D580;
color: #000;
}
ul.nav a:hover, ul.nav a:active, ul.nav a:focus {
background: #ADB96E;
color: #FFF;
}
/* ~~The footer ~~ */
.footer {
padding: 10px 0;
background: #CCC49F;
position: relative;
clear: both;
}
/* ~~miscellaneous float/clear classes~~ */
.fltrt {
float: right;
margin-left: 8px;
}
.fltlft {
float: left;
margin-right: 8px;
}
.clearfloat {
clear:both;
height:0;
font-size: 1px;
line-height: 0px;
}
.menu {
color: #414141;
font-size:16px;
font-weight:650;
text-align: center;
}
You don't need the dot (.) in class name.
Try this:
<li><a class='myclass' href="<?php echo base_url();?>index.php/controller">Search</a></li>
And jquery...
// This means select the `<a>` element with class `myclass`.
// Dot (.) means class selector.
$("a.myclass").click(function(){
var link = $(this);
var url = link.attr("href");
$(".content").load(url);
return false;
});
Well, I need more conditions to answer exactly, but I guess there are some css styles for myclass. Try to rename myclass to something like f-ajax-link-selector (don't forget to change it in JS) and try to refresh the page.

Categories