我的目標是簡單透明背景添加到HTML的身體,當有人在輸入文本字段如何在搜索時添加透明背景?
代碼
<body>
<div class="container">
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="/">Testing</a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<form novalidate="novalidate" onsubmit="return false;" class="searchbox sbx-amazon" style="margin-left: 20%" id="search-realtime">
<div role="search" class="sbx-amazon__wrapper">
<input type="search" id="search_input" name="search" placeholder="Search your product.." autocomplete="off" required="required" class="sbx-amazon__input">
<button type="submit" title="Submit your search query." class="sbx-amazon__submit">
<svg role="img" aria-label="Search">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#sbx-icon-search-11"></use>
</svg>
</button>
<button type="reset" title="Clear the search query." class="sbx-amazon__reset">
<svg role="img" aria-label="Reset">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#sbx-icon-clear-2"></use>
</svg>
</button>
</div>
</form>
</div>
</div>
</nav>
</div>
</body>
在稍後的搜索輸入上,輸入"I will"
查看結果 您可以檢查的jsfiddle全碼https://jsfiddle.net/Ldpqhkam/2/
集'不透明度:'任何東西小於1 –
你可以給它的覆蓋。隱藏它並根據輸入文本框中的值顯示它。 https://plnkr.co/edit/M4DryMbEk2QwUvFVTtAk?p=preview – lhavCoder