Home > PHP Framework > Laravel > body text

How to connect the entire Laravel project to paxj

藏色散人
Release: 2021-05-28 08:53:18
forward
3078 people have browsed it

The following tutorial column will introduce to you how to access paxj in the Laravel project. I hope it will be helpful to friends in need!                                                                                                                


Introduce js

<script></script>
Copy after login
//定义加载区域$(document).pjax('a', 'body');//定义pjax有效时间,超过这个时间会整页刷新$.pjax.defaults.timeout = 12000;//显示加载动画$(document).on('pjax:click', function () {
  $("#loading").show();});//隐藏加载动画$(document).on('pjax:end', function () {
  $("#loading").hide();});
Copy after login
#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 > p {
  background-color: rgba(0, 0, 0, 0.2);
  height: 100%;
  width: 6px;
  display: inline-block;
  -webkit-animation: stretchdelay 1.2s infinite ease-in-out;
  animation: stretchdelay 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 stretchdelay {
  0%,
  40%,
  100% {
    -webkit-transform: scaleY(0.4);
  }
  20% {
    -webkit-transform: scaleY(1);
  }}@keyframes stretchdelay {
  0%,
  40%,
  100% {
    transform: scaleY(0.4);
    -webkit-transform: scaleY(0.4);
  }
  20% {
    transform: scaleY(1);
    -webkit-transform: scaleY(1);
  }}
Copy after login
File Directory

composer require spatie/laravel-pjax


composer introduce laravel-pjaxHow to connect the entire Laravel project to paxjAdd in the app/Http/Kernel.php file

protected $middleware = [
    ...
    \Spatie\Pjax\Middleware\FilterIfPjax::class,];
Copy after login
    <p>
        </p><p>
            </p><p></p>
            <p></p>
            <p></p>
            <p></p>
            <p></p>
        
    
Copy after login
Related recommendations:

The latest five Laravel video tutorials

The above is the detailed content of How to connect the entire Laravel project to paxj. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:learnku.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template