search
HomeWeb Front-endJS TutorialPerfectly solves the problem about preloading InstantClick

This article mainly introduces the solution to the problem of preloading InstantClick. The editor thinks it is quite good. Now I will share it with you and give it as a reference. Let’s follow the editor to take a look.

During the transformation last night, the code highlighting could not be executed. To be precise, it was only executed once and not executed the second time. So I wrote an article to explain it, and after roughly reading the InstantClick documentation, I found that it is mainly a blacklist area issue. According to my personal understanding, the blacklist mainly includes two common filtering types, one is a tag and the other is js. According to its principle, the blacklist area is not processed (loaded and refreshed according to normal manual opening). This kind of non-processing can make the relevant structures and js work. .

So when InstantClick is executed, look at its reference statement:


##

<script type="text/javascript" src="<?php bloginfo(&#39;template_directory&#39;); ?>/js/instantclick.min.js" data-no-instant></script>
<script data-no-instant>InstantClick.init();</script>

The statement filters out InstantClick itself. It is equivalent to refreshing itself normally after execution.


Load and refresh js normally


The data-no-instant parameter of the statement itself means not to process it, and refresh this part of the structure normally. So if you want other js to work under InstantClick, you must refresh the js itself. You can write the code into instantclick.min.js, or you can use the data-no-instant parameter to reference it independently. If you do not write your own js into instantclick.min.js, you must use its four parameters to reload. Reference: http://instantclick.io/scripts



<script data-no-instant>
InstantClick.on(&#39;change&#39;, function() {
// 回调
});
InstantClick.init();
</script>

a tag

InstantClick does not process the a tag opened in a new window, and also has the data-no-instant parameter. The a tag under the tag package will not be processed either. For example,

this part will be refreshed as normal

.
Final summary: The

data-no-instant attribute is used to prevent instantclick from repeatedly loading the element when the page switches (meaning to refresh normally). It can be used in script, style tags, or in a tags, which means that the link will be opened in the normal way without instantclick acceleration, but it is useless for p tags, which you must know.

It will be easier to handle after understanding the above two points. Previously, it was understood as ajax, which was requested by the entire body. In other words, it is also possible to put the unprocessed part outside the body tag.


It is worth mentioning that I personally like its cache backward and forward function, which is very fast.

The above is the detailed content of Perfectly solves the problem about preloading InstantClick. For more information, please follow other related articles on the PHP Chinese website!

Statement
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
在Illustrator中加载插件时出错[修复]在Illustrator中加载插件时出错[修复]Feb 19, 2024 pm 12:00 PM

启动AdobeIllustrator时是否会弹出加载插件时出错的消息?一些Illustrator用户在打开该应用程序时遇到了此错误。消息后面紧跟着一系列有问题的插件。该错误提示表明已安装的插件存在问题,但也可能是由于VisualC++DLL文件损坏或首选项文件受损等其他原因引起。如果遇到此错误,我们将在本文中指导您修复问题,请继续阅读以下内容。在Illustrator中加载插件时出错如果您在尝试启动AdobeIllustrator时收到“加载插件时出错”的错误消息,您可以使用以下用途:以管理员身

Stremio字幕不工作;加载字幕时出错Stremio字幕不工作;加载字幕时出错Feb 24, 2024 am 09:50 AM

字幕在你的WindowsPC上不能在Stremio上运行吗?一些Stremio用户报告说,视频中没有显示字幕。许多用户报告说遇到了一条错误消息,上面写着“加载字幕时出错”。以下是与此错误一起显示的完整错误消息:加载字幕时出错加载字幕失败:这可能是您正在使用的插件或您的网络有问题。正如错误消息所说,可能是您的互联网连接导致了错误。因此,请检查您的网络连接,并确保您的互联网工作正常。除此之外,这个错误的背后可能还有其他原因,包括字幕加载项冲突、特定视频内容不支持字幕以及Stremio应用程序过时。如

插入超链接时Outlook冻结插入超链接时Outlook冻结Feb 19, 2024 pm 03:00 PM

如果您在向Outlook插入超链接时遇到冻结问题,可能是由于网络连接不稳定、Outlook版本旧、防病毒软件干扰或加载项冲突等原因。这些因素可能导致Outlook无法正常处理超链接操作。修复插入超链接时Outlook冻结的问题使用以下修复程序解决插入超链接时Outlook冻结的问题:检查已安装的加载项更新Outlook暂时禁用您的防病毒软件,然后尝试创建新的用户配置文件修复办公室应用程序卸载并重新安装Office我们开始吧。1]检查已安装的加载项可能是Outlook中安装的某个加载项导致了问题。

PHP实现无限滚动加载PHP实现无限滚动加载Jun 22, 2023 am 08:30 AM

随着互联网的发展,越来越多的网页需要支持滚动加载,而无限滚动加载是其中的一种。它可以让页面不断加载新的内容,使用户可以更流畅地浏览网页。在这篇文章中,我们将介绍如何使用PHP实现无限滚动加载。一、什么是无限滚动加载?无限滚动加载是一种基于滚动条的网页内容加载方式。它的原理是当用户滚动至页面底部时,通过AJAX异步调取后台数据,实现不断加载新的内容。这种加载方

css加载不出来怎么解决css加载不出来怎么解决Oct 20, 2023 am 11:29 AM

css加载不出来的解决办法有检查文件路径、检查文件内容、清除浏览器缓存、检查服务器设置、使用开发者工具和检查网络连接等。详细介绍:1、检查文件路径,首先请确保CSS文件的路径正确,如果CSS文件位于网站的不同部分或子目录中,需要提供正确的路径,如果CSS文件位于根目录下,路径应该是直接的;2、检查文件内容,如果路径正确,那么问题可能出在CSS文件本身,打开CSS文件检查等等。

安装win7加载usb驱动失败怎么办安装win7加载usb驱动失败怎么办Jul 11, 2023 am 08:13 AM

在安装win7系统中,有网友遇到了加载usb驱动失败的情况,usb设备无法在新的win7系统中被识别,常见的u盘,鼠标等设备就无法使用了。那么安装win7加载usb驱动失败怎么办?下面小白就教下大家安装win7加载usb驱动失败的解决方法。方法一:1、首先我们打开电脑进入电脑系统,在电脑系统查看电脑的系统版本。确认电脑系统的版本与设备驱动的版本是否一致。2、确认驱动的版本后,将USB设备连接到电脑系统。电脑系统显示,设备无法连接到系统。3、在连接信息页面,点击帮助按钮查看帮助信息。4、如果电脑系

JavaScript 如何实现滚动到页面底部自动加载的无限滚动效果?JavaScript 如何实现滚动到页面底部自动加载的无限滚动效果?Oct 27, 2023 pm 06:30 PM

JavaScript如何实现滚动到页面底部自动加载的无限滚动效果?无限滚动效果是现代网页开发中常见的功能之一,它可以在滚动到页面底部时自动加载更多内容,使得用户可以无需手动点击按钮或链接就能够获取更多的数据或资源。在本文中,我们将探讨如何使用JavaScript来实现这一功能,并提供具体的代码示例。实现滚动到页面底部自动加载的无限滚动效果,主要分为以下

Vue.js实现无限滚动加载的完整指南Vue.js实现无限滚动加载的完整指南Jun 09, 2023 pm 04:11 PM

随着数据量不断增加,网页的滚动加载逐渐成为了用户体验的重要部分。在这篇文章中,我们将讨论如何使用Vue.js实现无限滚动加载的完整指南。什么是无限滚动加载?无限滚动加载,又称为无限滚动,是一种Web设计技术,用于在用户滚动页面到底部时添加更多内容。这种技术常用于博客、社交媒体、在线商店等需要动态显示内容的网站上。无限滚动与分页不同。在传统的分页中,用户必须通

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools