问题

在给网站配置cdn后,pjax过渡动画失效了。

分析

打开f12,切换到console界面,刷新网址。看到下面警告信息:

The script from “https://tuziang.com/usr/themes/Fantasy/static/pjax.js” was loaded even though its MIME type (“text/html”) is not a valid JavaScript MIME type.
1629.html
The resource at “https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js” was blocked because content blocking is enabled.
1629.html
The script from “https://tuziang.com/usr/themes/Fantasy/static/pjax.js” was loaded even though its MIME type (“text/html”) is not a valid JavaScript MIME type.
1629.html
Loading failed for the <script> with source “https://tuziang.com/usr/themes/Fantasy/static/pjax.js”.

可以看到pjax.js文件没有加载成功。

解决

这是由于我在cdn管理中设置了防盗链功能。

关闭防盗链,或者设置白名单添加*.tuziang.com即可解决。