开发者 | majick |
---|---|
更新时间 | 2024年8月20日 08:19 |
捐献地址: | 去捐款 |
PHP版本: | 4.0.0 及以上 |
WordPress版本: | 6.6.1 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
/wp-content/plugins/
directory and unzip.= How do I get started?
Once you have activated the plugin, any internal links on your site will automatically be loaded via page transitions. Visit the plugin settings page to modify the default plugin behaviour.
Teleporter loads new content in iframes within the existing window, then uses the Browser History API to keep track of the content that is loaded. It then monitors the onpopstate
event so that browser forward and back buttons continue to load the desired content, with the added ability to fade between them.
Any standard <a>
link on the page that:
no-transition
or no-teleporter
(or other specified classes.)javascript
or #
or ?
or mailto:
or tel:
/wp-admin/
or wp-login.php
.no-teleporter="1"
.#wpadminbar
section.)click
event attached to it. (added in 1.1.0)As of 1.0.4, Teleporter will also handle dynamic link content. That is, links added to the page later. Simply specify the classes of these links on the plugin settings page, and they are then handled with click event delegation (instead of being directly adding to the a
link.) So for example, if you have a mobile menu that creates links upon expanding it with a .mobile-link
class, you can add mobile-link
in the plugin settings. When the mobile menu link is clicked, Teleporter will transition the page as normal. This makes it possible to use Teleporter with frontend builder or frameworks that add their content with javascript.
Similarly, if there are links that you wish to force to not transition for some reason, you can use the setting for ignore link classes in the same way. And, if you need to use selectors other than classes for these links, you can use the filters teleporter_dynamic_selectors
and teleporter_ignore_selectors
to add those respectively also.
As of 1.0.8, Teleporter includes a setting where you can specify pages (by slug or ID) to always refresh when clicked they are clicked through to.
This means that if a page already has been loaded in a Teleporter page session, and is switched away from, when it is switched back to, it is reloaded instead of simply switched back to.
Intended for use with cart or checkout pages. For example, if a customer visits their cart, then navigates away and adds another product, then switches back to the cart, the cart should be refreshed to show the new contents.
Note if there are other non-page URLS (eg. archives) where you want to force refresh also you can set the teleporter_refresh
filter to true for that condition.
No. Unlike similar plugins or libraries that use AJAX to retrieve new content and swap it on the current page, Teleporter uses iframes. This may seem a little counter-intuitive since iframes have been around forever and AJAX would seem to be the modern tool for the job. However, loading page content in an iframe means that any scripts loaded within that iframe are correctly loaded by the browser without fail. Using AJAX, there is a risk that the scripts in the current page and the new page are different, which could cause breakage as the new page's scripts are not initialized along with the content, and AJAX page transitioning does not (and cannot) address this issue.
If the page transitions are not working at all, it is likely you have another plugin causing a javascript error. This would prevent Teleporter from loading. Check you javascript console by right-clicking and selecting "Inspect" or "Inspect Element" then choose the "Console" tab from within the developer box. Javascript errors will be shown in red. You can try deactivating the plugin causing the error to see if this resolves the issue and if so report it to the plugin author. If the error is from Teleporter itself, please report it in the Plugin Support forum
You can run Teleporter in debug mode by appending ?teleporter-debug=1
to any URL on your site. This will load the unminified version of the script and output extra messages to the browser javascript debug console (see previous question.) If you make changes to the development script teleporter.dev.js
for testing purposes, you can reprocess that file into minified and unminified versions and debug simultaneously with ?teleporter-minify=1&teleporter-debug=1