On mouseout from float div hide but not from the main div
Hi, i am baby to jquery, this is my first try.
I want when the user mouseout from a drop menu to hide.
I have made it to a point but the menu disappears when it is out of the main div not the new one appearing.
Here is the html
- <div class="notifications">
- <button class="btn btn-primary" type="button">
- Notifications <span class="badge">2</span>
- </button>
-
- <div class="messages">
- <a href="#" class="message">This is a message</a>
- <a href="#" class="message">This is a message</a>
- </div>
- </div>
- </div>
Here is the jquery
- $(function() {
- $(".notifications .messages").hide();
- $(".notifications").click(function() {
-
- if ($(this).children(".messages").children().length > 0) {
- $(this).children(".messages").fadeToggle(300);
- }
-
- });
- $(".notifications .messages").mouseout(function() {
-
- $(".notifications .messages").hide();
-
- });
- });
and the css if needed
-
- .notifications {
- display:block;
- background-color:white;
- border-radius:50%;
- }
-
- .notifications .toggle {
- display:block;
- position:absolute;
- width:100%;
- height:100%;
- }
-
- .notifications .toggle:before,
- .notifications .toggle:after {
- content:'.';
- display:block;
- position:absolute;
- left:35px;
- width:10px;
- background-color:#bdc3c7;
- color:transparent;
- border-radius:5px;
- }
-
-
- .notifications .messages {
- display:block;
- position:absolute;
- top:50px;
- left:0px;
- width:240px;
- max-height:240px;
-
- }
-
- .notifications .messages:before {
- content:'.';
- display:block;
- position:absolute;
-
- left:0px;
- top:-18px;
- width:0;
- height:0;
- color:transparent;
- border:10px solid black;
- border-color:transparent transparent white;
- }
-
- .notifications .messages .message {
- display:block;
- position:relative;
- padding:10px;
- background-color:white;
- color:black;
- text-decoration:none;
- }
-
- .notifications .messages .message + .message {
- border-top:1px solid #e0e0e0;
- }
Any help is valuable.
I am happy learning such language , i know php and jquery is so necesery those days :)