## 所需資源
[boodcdn的pjax的js代碼]([https://www.bootcdn.cn/jquery.pjax/](https://www.bootcdn.cn/jquery.pjax/))
必須資源:**jQuery.js**
加載動畫`pjaxcss`:
```css
#loading {
background-color: rgba(238, 238, 238, 0.6);
display: none;
position: absolute;
left: 0;
top: 0;
right: 0;
z-index: 2000;
bottom: 0;
padding-top: 10%;
}
#loading .spinner {
margin: 100px auto;
width: 50px;
height: 60px;
text-align: center;
font-size: 10px;
}
#loading .spinner > div {
background-color: rgba(0, 0, 0, 0.2);
height: 100%;
width: 6px;
display: inline-block;
-webkit-animation: stretchdely 1.2s infinite ease-in-out;
animation: stretchdely 1.2s infinite ease-in-out;
}
#loading .spinner .rect2 {
-webkit-animation-delay: -1.1s;
animation-delay: -1.1s;
}
#loading .spinner .rect3 {
-webkit-animation-delay: -1s;
animation-delay: -1s;
}
#loading .spinner .rect4 {
-webkit-animation-delay: -0.9s;
animation-delay: -0.9s;
}
#loading .spinner .rect5 {
-webkit-animation-delay: -0.8s;
animation-delay: -0.8s;
}
@-webkit-keyframes stretchdely {
0%,40%,100% {
-webkit-transform: scaleY(0.4);
}
20% {
-webkit-transform: scaleY(1);
}
}
@keyframes stretchdely {
0%,40%,100% {
transform: scaleY(0.4);
-webkit-transform: scaleY(0.4);
}
20% {
transform: scaleY(1);
-webkit-transform: scaleY(1);
}
}
```
## 使用
>在使用模板繼承中,在基礎頁面里添加公共區域部分的代碼:
```html
<div id="pjax-container">
<div id="loading">
<div class="spinner">
<div class="rect1"></div>
<div class="rect2"></div>
<div class="rect3"></div>
<div class="rect4"></div>
<div class="rect5"></div>
</div>
</div>
{block name="content"}
{/block}
</div>
```
>引入js之后進行js處理
```javascript
<script>
// 實現頁面無刷新跳轉url
$(document).pjax('a[pjax]', '#pjax-container', {fragment: "#pjax-container", timeout: 5000});
$(document).on('pjax:send', function() {
$("#loading").show();
});
$(document).on('pjax:complete', function () {
$("#loading").hide();
})
</script>
```
- PHP獲取客戶端瀏覽器信息和版本
- PHP獲取客戶端操作系統信息
- 無限級分類
- git使用
- 權限檢測思路
- Vue學習
- 遇到的一些問題
- PHP的編碼思維和技巧
- mysql復習
- tp5
- ThinkPHP5.x 公共函數
- TP5登錄注冊
- TP5使用模板繼承
- ThinkPHP5.1 清除緩存
- thinkphp5實現安裝程序
- 安全
- tp中實現跨域代碼
- ThinkPHP5.1配合pjax實現菜單欄無刷新跳轉
- 獲取數據庫版本和數據庫大小
- 模型的基本CURD操作
- 商品spu
- 全局異常處理類
- ExceptionHandler
- BaseException
- PHP函數之error_reporting(E_ALL ^ E_NOTICE)詳細說明
- 微信小程序
- wx:for
- tp6
- 分離的一些模塊
- session開啟
- Spring
- 依賴注入
- 數據結構
- 二叉樹
- js獲取地址欄變量
- PHP設計模式
- 面向對象
- PHP1
- PHP性能優化
- Java學習
- static關鍵字
- 多態
- 接口、階乘
- 大佬給的面試題
- 訪問量為5000萬的博客系統設計
- PHP可變參數
- Nginx的配置案例
- 求數組中的最大值,并返回數組索引
- PHP面試方向
- PHP數組工具類ArrUtil
- 字符串工具類StrUtil
- PHP使用curl發送請求
- mysql
- PHP上傳base64圖片處理函數
- webstorm小程序常用配置
- 郵箱正則表達式
- leetcode mysql記錄
- 函數庫