Why is the content starting below the input textfield?

rotaercz

Why is the content starting below the input textfield?

Here's a fiddle: http://jsfiddle.net/q646Ljg6/4/

HTML:

<div id="navigation" class="navigation">
    <div id="dropmenu" class="dropmenu">
        <login>
            <ul>
                <li> <a href="#" ><span id="cart-button" class="flaticon flaticon-cart" aria-hidden="true"></span></a>

                </li>
                <li> <a href="javascript:void(0);">Dropdown C</a>

                    <ul>
                        <li><a href="#" >Option 1</a>
                        </li>
                        <li><a href="#" >Option 2</a>
                        </li>
                        <li><a href="#" >Option 3</a>
                        </li>
                    </ul>
                </li>
            </ul>
        </login>
        <ul>
            <li> <a href="/">Home</a>

            </li>
            <li> <a href="javascript:void(0);" >Dropdown A</a>

                <div class="sub-menu">
                    <div class="sub-menu-inner">
                        <div>
                            <ul>
                                <li><a href="#" >Dropdown A - 1</a>
                                </li>
                                <li><a href="#" >Dropdown A - 2</a>
                                </li>
                            </ul>
                        </div>
                    </div>
                    <!-- /sub-menu-inner -->
                </div>
                <!-- /sub-menu -->
            </li>

            <li> <a href="javascript:void(0);" >Dropdown B</a>

                <div class="sub-menu">
                    <div class="sub-menu-inner">
                        <div>
                            <ul>
                                <li> <a href="#" >Dropdown B - 1</a>

                                    <ul>
                                        <li><a href="#" >Dropdown B - 1 - 1</a>
                                        </li>
                                    </ul>
                                </li>
                                <li><a href="#" >Dropdown B - 2</a>
                                    <ul>
                                        <li><a href="#" >Dropdown B - 2 - 1</a>
                                        </li>
                                        <li><a href="#" >Dropdown B - 2 - 2</a>
                                        </li>
                                    </ul>
                                </li>
                            </ul>
                        </div>
                    </div>
                    <!-- /sub-menu-inner -->
                </div>
                <!-- /sub-menu -->
            </li>
            <li style="float:none;overflow:hidden;">
                <div class="dark width-max"> <span>
                        <input id="quick-search" data-load="content" data-url="/quicksearch"  class="search" type="text" placeholder="Quick Search" maxlength="50" autocomplete="off">
                        <div id="search-results" class="search-results"></div>
                    </span>

                </div>
            </li>
        </ul>
    </div>
</div>
<div>
content content content content content content content content content content content content content content content content content content content content content content content content </div>

Javascript:

var currentTop = -1;
var currentSub = -1;
var currentProfile = -1;
//var topMenu = '';
//var subMenu = '';
var lastToggled = '';

function InitNav() {
    //$body.on('click', '#dropmenu > ul > li > a', ToggleTop);
    $('#dropmenu > ul > li > a', 'body').mouseenter(ToggleTop);
    $('#dropmenu', 'body').mouseleave(ToggleTop);

    $body.on('click', '#dropmenu > ul > li ul > li > a', ToggleSub);
    $('#dropmenu login a', 'body').mouseenter(ToggleProfileIn).mouseleave(ToggleProfileOut);
    $body.on('click', '#dropmenu login a', ToggleProfile);
}

function ToggleTop(e) {
    var $listItems = $('#dropmenu > ul > li');

    if (currentProfile !== -1) { // reset profile if needed
        lastToggled.removeClass('toggled');
    }

    if (currentTop !== -1) { // reset top menu
        $listItems.eq(currentTop).removeClass('toggled');
    }

    var $currentTarg = $(e.currentTarget);
    var $item = $currentTarg.parent('li');
    var index = $item.index();

    if (currentTop === index) { // reset
        $item.removeClass('toggled');
        currentTop = -1;
    } else { // set
        $item.addClass('toggled');
        currentTop = index;
    }


    return false;
}

function ToggleSub(e) {
    var $listItems = $('#dropmenu .sub-menu-inner > div > ul > li');

    if (currentSub !== -1) { // reset
        $listItems.removeClass('selected');
    }

    var $currentTarg = $(e.currentTarget);
    var $item = $currentTarg.closest('#dropmenu .sub-menu-inner > div > ul > li');
    var index = $item.index();

    // set
    $item.addClass('selected');
    currentSub = index;

    return false;
}

function ToggleProfileIn(e) {
    var $listItems = $('#dropmenu > ul > li');

    if (currentTop !== -1) { // reset
        lastToggled = $listItems.eq(currentTop).removeClass('toggled');
    }
}

function ToggleProfile(e) {
    currentTop = -1;

    var $listItems = $('#dropmenu login > ul > li');

    if (currentProfile !== -1) { // reset
        $listItems.removeClass('toggled');
    }

    var $currentTarg = $(e.currentTarget);
    var $item = $currentTarg.closest('#dropmenu login > ul > li');
    var index = $item.index();

    // set
    currentProfile = index;
    lastToggled = $item.addClass('toggled');

    return false;
}

function ToggleProfileOut(e) {
    if (currentTop !== -1) { // restore
        lastToggled.addClass('toggled');
    }
}

InitNav();

CSS:

.navigation {
    width: 100%;
    height: 36px;
    background-color: rgb(243, 245, 245);
}
.dropmenu {
    position: relative;
    width: 100%;
    height: 36px;
    font-weight: bold;
    background: #3e494b;
    /* menu background color */
}
.dropmenu ul {
    list-style-type: none;
    z-index: 50;
}
/* first level ul style */

/* .dropmenu > ul, */
 .dropmenu .sub-menu-inner {
    margin: 0 auto;
    /*
    background: rgb(130, 160, 46);
    background: rgba(255, 160, 46, 0.92);
    */
}
.dropmenu > ul > li {
    float: left;
    z-index: 50;
}
.dropmenu > ul > li:nth-of-type(1) {
    width: 187px;
}
.dropmenu > ul > li > a {
    display: inline-block;
    padding: 10px 20px;
    color: #b1b6b9;
    /* grey menu text color */
}
.dropmenu > ul > li > a:hover {
    padding: 10px 20px 10px;
    /* correlation with underline */
    /*
    border-top: 3px solid;
    border-top-color: #b1b6b9;
    */
    background-color: #596466;
    /* #3e494b; /* dark grey */
    color: #ffffff;
}
.dropmenu > ul > li.toggled > a, .dropmenu > ul > li.toggled > a:hover {
    padding: 10px 20px 10px;
    /* correlation with underline */
    /*
    border-top: 3px solid;
    border-top-color: #b1b6b9;
    */
    background-color: #596466;
    /* #3e494b; /* dark grey */
    color: #ffffff;
}
/* sub-menu */
 .dropmenu .sub-menu {
    display: none;
    position: absolute;
    /* background: #00a3da; */
    width: 100%;
    left: 0;
    -webkit-box-shadow: 0 4px 5px -5px #000000;
    -moz-box-shadow: 0 4px 5px -5px #000000;
    box-shadow: 0 4px 5px -5px #000000;
}
.toggled .sub-menu {
    display: block;
    width: 100%;
    background: #596466;
    /* sub menu color */
    /* border: 1px solid red; /**/
}
.dropmenu .sub-menu-inner > div {
    width: 100%;
    height: 100%;
    float: left;
    /* border: 1px solid green; /**/
}
/*
.dropmenu .sub-menu-inner > div > ul {

}
/**/
 .dropmenu .sub-menu-inner > div > ul > li {
    display: inline;
    overflow: hidden;
    position: relative;
}
.dropmenu .sub-menu-inner > div > ul > li:nth-of-type(1) {
    margin-left: 187px;
}
.dropmenu .sub-menu-inner > div > ul > li > a {
    padding: 10px 20px;
    color: #d5d5d5;
    /* border: 1px solid red; */
}
.dropmenu .sub-menu-inner > div > ul > li > a:hover {
    padding: 10px 20px 10px;
    /* correlation with underline */
    color: #ffffff;
}
.dropmenu .sub-menu-inner > div > ul > li.selected > a, .dropmenu .sub-menu-inner > div > ul > li.selected > a:hover {
    padding: 10px 20px 10px;
    /* correlation with underline */
    /*
    background-color: rgb(243, 245, 245);
    background-color: rgba(243, 245, 245, 0.9); /* almost white */
    color: #ffffff;
}
.dropmenu .sub-menu-inner:before, .dropmenu .sub-menu-inner:after {
    content:" ";
    display: table;
}
.dropmenu .sub-menu-inner:after {
    clear: both;
}
.dropmenu .sub-menu-inner > div a {
    line-height: 36px;
}
/* drop-sub-menu */
 .dropmenu .sub-menu-inner ul ul {
    display: none;
    position: absolute;
}
.dropmenu .sub-menu-inner ul > li:hover ul {
    display: block;
    left: 0px;
}
.dropmenu .sub-menu-inner ul > li > ul > li > a {
    display: block;
    padding: 0px 20px;
    width: 145px;
    background: #596466;
    /* sub menu color */
    color: #d5d5d5;
}
.dropmenu .sub-menu-inner ul > li > ul > li > a:hover {
    /* background: #798486; /* sub menu hover color */
    color: #ffffff;
}
/* login menu */
 .dropmenu login ul {
    margin: 0;
}
.dropmenu login > ul > li {
    position: relative;
    float: right;
}
.dropmenu login > ul > li > a {
    display: inline-block;
    padding: 10px 20px;
    color: #b1b6b9;
    /* grey menu text color */
}
.dropmenu login > ul > li > a:hover {
    background-color: #596466;
    /* #3e494b; /* dark grey */
    color: #ffffff;
}
#cart-button {
    font-size: 14px;
}
/* login drop-down */
 .dropmenu login ul ul {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
}
.dropmenu login ul > li:hover ul {
    display: block;
}
/* login sub-menu */
 .dropmenu login > ul > li > ul > li > a {
    display: inline-block;
    width: 100px;
    padding: 10px 20px;
    background: #3e494b;
    /* menu background color */
    color: #b1b6b9;
    /* light grey */
}
.dropmenu login > ul > li > ul > li > a:hover {
    background-color: #596466;
    /* #3e494b; /* dark grey */
    color: #ffffff;
}
.dropmenu login > ul > li.toggled > a, .dropmenu login > ul > li.toggled > a:hover {
    padding: 10px 20px 10px;
    /* correlation with underline */
    background-color: #596466;
    color: #ffffff;
}
.width-max {
    margin: 2px 10px 0 5px;
    float:none;
    overflow:hidden;
}
connexo

Give the div that surrounds your content clear: both;.

<div style="clear: both;">content content...</div>

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

TextField as3 getting the input

분류에서Dev

Why this below exec command is not working

분류에서Dev

How to verify the user input in a textfield to compare it with a variable?

분류에서Dev

starting server with nohup and redirecting input, output

분류에서Dev

Why will "ls" not list files starting with "." in Linux

분류에서Dev

Why is SED not accepting my input?

분류에서Dev

Mule compilation failed with maven : Invalid content was found starting with element 'db:generic-config'

분류에서Dev

Using lxml in Python, I need to replace "RNA" with <mark>RNA</mark> in input xml file. Code below

분류에서Dev

Why content is not same after parsing with Jsoup

분류에서Dev

How do i replace 'view Ember.TextField' with 'input' in an emblem template?

분류에서Dev

Why is background-image not working for Input?

분류에서Dev

why pipes are used instead of input redirection

분류에서Dev

Why both of if statements are executed no matter what the input is?

분류에서Dev

Why is the return type of input stream off int?

분류에서Dev

Why my input doesn't fit into the div?

분류에서Dev

Why delegate method shows no input value?

분류에서Dev

Why is this program not printing the input I provided? (C)

분류에서Dev

Why is a dynamic input value not showing a change with Angularjs?

분류에서Dev

Why is the error handling not working for None input?

분류에서Dev

Why Am I getting this Input Error?

분류에서Dev

Why does the below code run without an error when both overlapping fields are used?

분류에서Dev

Why tilde (~) doesn't expand when used with CLI argument starting with dash?

분류에서Dev

How to diagnose, why Linux Mint host freezes after starting Virtualbox VM

분류에서Dev

How do you get Python to open a text file using print and input? I have the code I am using below

분류에서Dev

react-phone-number-input과 함께 material-ui TextField를 사용하는 방법

분류에서Dev

Why does a borderless Kivy Window shift content down and to the right?

분류에서Dev

Why does Padrino ignore the content type and force "application/json"?

분류에서Dev

Why do i get this big gap between my content

분류에서Dev

Why 'cat' can't read content of pdf files?

Related 관련 기사

  1. 1

    TextField as3 getting the input

  2. 2

    Why this below exec command is not working

  3. 3

    How to verify the user input in a textfield to compare it with a variable?

  4. 4

    starting server with nohup and redirecting input, output

  5. 5

    Why will "ls" not list files starting with "." in Linux

  6. 6

    Why is SED not accepting my input?

  7. 7

    Mule compilation failed with maven : Invalid content was found starting with element 'db:generic-config'

  8. 8

    Using lxml in Python, I need to replace "RNA" with <mark>RNA</mark> in input xml file. Code below

  9. 9

    Why content is not same after parsing with Jsoup

  10. 10

    How do i replace 'view Ember.TextField' with 'input' in an emblem template?

  11. 11

    Why is background-image not working for Input?

  12. 12

    why pipes are used instead of input redirection

  13. 13

    Why both of if statements are executed no matter what the input is?

  14. 14

    Why is the return type of input stream off int?

  15. 15

    Why my input doesn't fit into the div?

  16. 16

    Why delegate method shows no input value?

  17. 17

    Why is this program not printing the input I provided? (C)

  18. 18

    Why is a dynamic input value not showing a change with Angularjs?

  19. 19

    Why is the error handling not working for None input?

  20. 20

    Why Am I getting this Input Error?

  21. 21

    Why does the below code run without an error when both overlapping fields are used?

  22. 22

    Why tilde (~) doesn't expand when used with CLI argument starting with dash?

  23. 23

    How to diagnose, why Linux Mint host freezes after starting Virtualbox VM

  24. 24

    How do you get Python to open a text file using print and input? I have the code I am using below

  25. 25

    react-phone-number-input과 함께 material-ui TextField를 사용하는 방법

  26. 26

    Why does a borderless Kivy Window shift content down and to the right?

  27. 27

    Why does Padrino ignore the content type and force "application/json"?

  28. 28

    Why do i get this big gap between my content

  29. 29

    Why 'cat' can't read content of pdf files?

뜨겁다태그

보관