【问题标题】:i want search box only on the page , rest invisible after clicking inside search box我只想要页面上的搜索框,在搜索框内点击后不可见
【发布时间】:2016-01-13 12:32:25
【问题描述】:

我想创建一个页面,如果我在搜索框内单击,页面上的所有内容都会变得不可见。只有徽标搜索框和我的帐户按钮应该留在顶部

我的网站(http://geri.in/unloc/Bootstrap_stockrid/index.html)

【问题讨论】:

    标签: javascript jquery html bootstrapping


    【解决方案1】:

    你不能只使用 css 和 html,你还需要 javascript/jquery。

    这里有一个示例函数,您可以使用它来开始您想做的事情:

    $("#adv-search input").on("focus",function(){
      $("#myCarousel,#text-carousel,.jumbotron").fadeOut();
    });
    $("#adv-search input").on("blur",function(){
      $("#myCarousel,#text-carousel,.jumbotron").fadeIn();
    });
    

    你应该为每个你想要隐藏的主容器或元素添加一个类,而不是用它替换上面脚本中的fadeIn/fadeOut类。

    【讨论】:

    • 感谢您的帮助。我从中得到了基本的想法。休息我可以跟进。
    猜你喜欢
    • 2011-09-03
    • 1970-01-01
    • 2021-07-18
    • 1970-01-01
    • 2018-10-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多