注册时间2024-11-22
最后登录2026-6-10
在线时间1669 小时
UID1
买家信用
卖家信用
总共送礼:1 个
总共收礼:0 个
实力·绝代收藏家
|
交易无需等待,成交就是现在,全面资源整合网络大咖云集,让你轻松玩转互联网!
您需要 登录 才可以下载或查看,没有账号?立即注册
×
在这篇文章之前腾飞博客分享过两篇,不过今天这次分享的不一样,之前的是固定的,而今天的百度一下的样式是获取当前页面的标题,而且是打字自动输入的一款样式效果,喜欢的自行部署吧!
代码部署
定位:WP后台–>>外观–>>小工具–>>自定义HTML,直接将下面的代码丢到里面,然后放到侧边即可!
- <style>
- .searchs {
- background-color: var(--main-bg-color);
- padding: 15px;
- overflow: hidden;
- transition: all 0.3s;
- border-radius: 4px;
- position: relative;
- margin: 20px 0 25px 0;
- box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
- transform: translateY(-4px);
- border-top: 2px solid rgba(51, 133, 255, 0.2);
- }
- mip-form form {
- position: relative;
- display: flex;
- align-items: center;
- }
- .searchs input[type="text"] {
- border: 2px solid #3385FF;
- border-right: none;
- border-radius: 4px 0 0 4px;
- width: 100%;
- padding: 8px 12px;
- font-size: 14px;
- transition: all 0.3s;
- box-sizing: border-box;
- height: 38px;
- line-height: 18px;
- margin: 0;
- background-color: var(--footer-bg);
- }
- .searchs input[type="submit"] {
- background: linear-gradient(to bottom, #3385FF, #2a7ae9);
- color: #fff;
- font-size: 14px;
- height: 38px;
- padding: 0 15px;
- border: 2px solid #3385FF;
- border-left: none;
- border-radius: 0 4px 4px 0;
- cursor: pointer;
- transition: all 0.3s;
- margin: 0;
- line-height: 18px;
- box-shadow: 1px 0 2px rgba(0,0,0,0.1);
- }
- .tit {
- background: linear-gradient(to right, #3385FF, #2a7ae9);
- position: relative;
- top: -15px;
- display: inline-block;
- color: #fff;
- padding: 6px 15px;
- font-size: 14px;
- border-radius: 4px 4px 0 0;
- box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
- text-shadow: 0 1px 1px rgba(0,0,0,0.2);
- }
- </style>
- <div class="searchs">
- <div class="tit"><strong>百度一下</strong></div>
- <mip-form method="get" url="https://www.baidu.com/s" class="mip-element mip-layout-container">
- <form action="https://www.baidu.com/s" method="GET" target="_blank">
- <input type="text" name="wd" placeholder="正在加载..." id="searchInput">
- <input type="submit" value="搜索">
- </form>
- </mip-form>
- </div>
- <script>
- const pageTitle = document.title.replace(/_百度搜索$/, '').trim() || "习听风雨";
- document.addEventListener('DOMContentLoaded', function() {
- const searchInput = document.getElementById('searchInput');
- let i = 0;
- function typeWriter() {
- if (i < pageTitle.length) {
- searchInput.value += pageTitle.charAt(i);
- i++;
- setTimeout(typeWriter, 100);
- }
- }
- setTimeout(typeWriter, 500);
- searchInput.addEventListener('focus', function() {
- this.select();
- });
- });
- </script>
复制代码
|
|