0

Have some trouble figuring this out any help wold be great thank you in advance

I have a menu that looks something like this

HTML

<li class="menuItem"><a href="#" class="drop" onclick="doWork();">Phones</a>

        <div class="flyout">

            <div class="col_1">

                <a href="#"><h3>Phones</h3></a>
                <ul>
                    <li><a href="https://www.google.com/" target="_top">Nokie</a></li>
                    <li><a href="https://www.google.com/" target="_blank">Iphone</a></li>
                    <   
                </ul>            
        </div>   
    </li>

with 2 css

.menuItem:hover {
border: 1px solid #777777;  

/* Background color and gradients */
background: #fafafa; /* Old browsers */
background: -moz-linear-gradient(top, #fafafa 0%, #fcfcfc 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#fafafa), color-stop(70%,#fcfcfc), color-stop(100%)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #fafafa 0%,#fcfcfc 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #fafafa 0%,#fcfcfc 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #fafafa 0%,#fcfcfc 100%); /* IE10+ */
background: linear-gradient(to bottom, #fafafa 0%,#fcfcfc 100%); /* W3C */

/* Rounded corners */
-moz-border-radius: 5px 5px 0px 0px;
-webkit-border-radius: 5px 5px 0px 0px;
border-radius: 5px 5px 0px 0px;
}

.menuItem:hover .flyout
 {
display:block;
top:auto;
left:0px;
}

how would you call those 2 class on a onclick function?

Neo
  • 481
  • 2
  • 9
  • 24

1 Answers1

0

Use jQuery to add/remove or toggle a class:

$( document ).ready(function() {
    $("p").click(function () {
        $('.menuItem').addClass('flyout');
    });
});

This in CSS:

.flyout {
    display:block;
    top:auto;
    left:0px;
}
achudars
  • 1,486
  • 15
  • 25