The forum of the forums

Would you like to react to this message? Create an account in a few clicks or log in to continue.
The forum of the forums
3 posters

    How to make a search Image actually work

    Zed is Not Dead
    Zed is Not Dead
    Forumember


    Posts : 257
    Reputation : 28
    Language : English

    Solved How to make a search Image actually work

    Post by Zed is Not Dead October 5th 2015, 4:03 am

    I want to make this image right here

    How to make a search Image actually work  UY1aH5I

    Actually work like a search bar, I know it requires coding, mind helping me out?
    Beyonder
    Beyonder
    Forumember


    Male Posts : 723
    Reputation : 29
    Language : English
    Location : Beyond Realm

    Solved Re: How to make a search Image actually work

    Post by Beyonder October 5th 2015, 5:55 am

    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: How to make a search Image actually work

    Post by Ange Tuteur October 5th 2015, 10:52 am

    Hi @Zed is Not Dead,

    That should be pretty easy, just need the magnifying glass and search image. Where would you want it inserted, though ?
    Zed is Not Dead
    Zed is Not Dead
    Forumember


    Posts : 257
    Reputation : 28
    Language : English

    Solved Re: How to make a search Image actually work

    Post by Zed is Not Dead October 5th 2015, 11:23 am

    on the nav bar the overall nav bar will look like this

    How to make a search Image actually work  PAhiVpu
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: How to make a search Image actually work

    Post by Ange Tuteur October 5th 2015, 12:20 pm

    Oh I see, add the following CSS to your stylesheet :
    Code:
    #navbar-search {
      position:relative;
      display:inline-block;
      opacity:1;
    }
    #nav-search-box, #nav-search-button { position:absolute }
    #nav-search-form { display:inline }


    #nav-search-box {
      color:#FFF;
      background:transparent;
      border:1px solid transparent;
      border-radius:9px;
      top:17px;
      left:14px;
      width:172px;
      height:20px;
      padding:3px;
    }

    #nav-search-button {
      background:transparent;
      border:1px solid transparent;
      width:100px;
      height:40px;
      top:12px;
      right:16px;
    }


    Then go to Modules > JavaScript codes management and create a new script with the following settings.

    Placement : In all the pages
    Code:
    $(function() {
      var search = document.getElementById('i_icon_mini_search'), form;

      if (search) {
        form = document.createElement('FORM');
        search = search.parentNode;
        search.id = 'navbar-search';
        search.onclick = function(e) { e.preventDefault() };

        form.method = 'get';
        form.action = '/search';
        form.id = 'nav-search-form';
        form.innerHTML = '<input id="nav-search-box" type="text" name="search_keywords"/><input id="nav-search-button" type="submit" value="" onclick="this.parentNode.submit();"/>';

        search.appendChild(form);
      }
    });

    It should add a transparent input and button over the navbar image.
    Zed is Not Dead
    Zed is Not Dead
    Forumember


    Posts : 257
    Reputation : 28
    Language : English

    Solved Re: How to make a search Image actually work

    Post by Zed is Not Dead October 5th 2015, 8:38 pm

    thanks! this is solved
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: How to make a search Image actually work

    Post by Ange Tuteur October 5th 2015, 9:48 pm

    You're welcome ^^

    Topic archived

    Have a great day. Smile

      Current date/time is September 23rd 2024, 5:14 am