Click here to Skip to main content
15,891,845 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I´m trying to when I click in my search icon the input expands with nice effect. I found a tutorial that explains what I was trying to do. I follow the tutorial but in my example is not working, I guess I did everything correct. Anyone there already tried to do this?
Can give a little help? The only difference that I have from the example is that I have the input inside my menu like this:

XML
<nav id="menu">
        <ul>
            <li><a href="index.php">Home</a></li>
            <li><a href="Products.php">Products</a></li>
            <li><a href="Services.php">Services</a></li>
            <li><a href="About.php">About</a></li>
            <li><a href="Contacts.php">Contacts</a></li>
            <li style="float:right; list-style:none"</li>
               <div id="sb-search" class="sb-search">
                <form>
                  <input class="sb-search-input" placeholder="Enter your search term..." type="text" value="" name="search" id="search">
                   <input class="sb-search-submit" type="submit" value="">
                   <span class="sb-icon-search"></span>
                </form>
              </div>
            </li>
         </ul>
    </nav>

The link for tutorial that I followed: http://tympanus.net/codrops/2013/06/26/expanding-search-bar-deconstructed/

What I´m getting: http://jsfiddle.net/ritz/knprc/1/
Posted

The way you are using is wrong. First of all download the Source Code from the link you have provided.

You will see many folders like js and CSS containing the required JavaScript and CSS files.
Check the source of index.html page and see how these js and CSS files are included.

More importantly, the UISearch function is called like...(inside body).
XML
<script>
    new UISearch( document.getElementById( 'sb-search' ) );
</script>

So, you should follow the same procedure to execute the code.
 
Share this answer
 
Thanks for your answer, I tried to put his in my code and now works but works very badly Can you see here below what I´m doing wrong?

XML
<script src="modernizr.custom.js"></script>

        <script src="js/classie.js"></script>
        <script src="js/uisearch.js"></script>
        <script>
            new UISearch( document.getElementById( 'sb-search' ) );
        </script>


XML
<nav id="menu">
        <ul>
            <li><a href="index.php">Home</a></li>
            <li><a href="Products.php">Products</a></li>
            <li><a href="Services.php">Services</a></li>
            <li><a href="About.php">About</a></li>
            <li><a href="Contacts.php">Contacts</a></li>
            <li style="float:right; list-style:none"</li>
               <div id="sb-search" class="sb-search">
                <form>
                  <input class="sb-search-input" placeholder="Enter your search term..." type="text" value="" name="search" id="search">
                   <input class="sb-search-submit" type="submit" value="">
                   <span class="sb-icon-search"></span>
                </form>
              </div>
            </li>
         </ul>
    </nav>



My css for menu:

CSS
#menu
{
    width:960px;
    height:auto;
    margin:0 auto 0 auto;
}

#menu ul
{
    list-style-type:none;
}

#menu ul li
{
    float:left;
    height:46px;
    line-height:46px;
    font-family:'bariol_regularregular';
    font-weight:300;

}

#menu ul li a
{
    text-decoration:none;
    color:#ccc;
    display:block;
    margin-right:5px;
    height:46px;
    line-height:46px;
    padding:0 5px 0 5px;
    font-size:20px;

}
 
Share this answer
 
Comments
What works bad here? You should reply inside my answer. But you have added one answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900