移动端输入框输入完内容后点击软键盘上的搜索按钮进行搜索

<div class="search_header">
    <div><i class="iconfont icon-mulu"></i></div>

    <div class="search_input">

        <i class="iconfont icon-search1"></i>
        <form action="#">
            <input class="search_content" style="border: none" type="search" placeholder="请输入关键字">
        </form>
    </div>

</div>
body {
    background-color: #f3f3f3;
}
.search_header {
    display: flex;
    padding: 5px 10px;
    background-color: #960001;
    align-items: center;
}
.icon-mulu {
    color: white;
    font-size: 20px;
    margin-right: 8px;

}
.icon-search1 {
    color: #dcdcdd;
    display: block;
    margin-top: 4px;
    line-height: 1.1;
    font-size: 25px;
}
.search_input {
    background-color: white;
    display: flex;
    align-items: center;
    flex: 1;
    padding-left: 5px;
    border-radius: 2px;
    margin-right: 5px;
}
//    搜索 绑定确认按钮
        $("form").on("submit",function (e) { //这是写死的不用改 直接在下面调AJAX就行
            var keyword = $(".search_content").val(); //输入的内容
            $.Ajax({
                url:baseUrl + "AmoySource/client/topic/search",
                is_login:true,
                data:{
                    keyword:keyword
                },
                success:function (res) {
                    alert(JSON.stringify(res))
                    if (res.code == 1){
                        var Post = "Post";
                        var tem_Post = template(Post,res.result);
                        $(".msgg").html(tem_Post);
                        var width = window.screen.width;
                        var width_one = (width - 20) * 0.6;
                        var width_two = (width - 30) * 0.4; //两张照片的宽
                        var width_three = (width-40)/3;//三张图片的宽
                        $(".ongimg_width").css("width",width_one + "px");
                        $(".ongimg_width").css("height",width_one + "px");
                        $(".twoimg_width").css("width",width_two + "px");
                        $(".twoimg_width").css("height",width_two + "px");
                        $(".threeimg_width").css("width",width_three + "px");
                        $(".threeimg_width").css("height",width_three + "px");

                    }else {
                        $.toast(res.result);
                    }
                }
            });

            return false;
        })

 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值