Add personalized input fireworks and vibration effects to your WordPress website to make your website more lively and interesting!

As a member of WordPress users, I really worked hard to pretend (although the js file was not written by me). A firework and vibration special effect in the WordpPress  input box, because it is a js file called, so it can be used not only in  WordPress , but also in other websites. The js special effects include fireworks and vibration special effects, and you can enable or disable a certain effect respectively.

How to install WordPress input fireworks and vibration effects:

The first step is to download the JS file: activate-power-mode.js (you can click it to download), and upload it to the JS folder of the theme.

The second step is to install the code: add the following code to the end of the theme footer.php file or where you think it is appropriate.

 
 

1
2
3
4
5
6

<script src="<?php bloginfo('template_directory'); ?>/includes/js/activate-power-mode.js "></script> <script> POWERMODE.colorful = true; // true is to
enable
fireworks special effects
POWERMODE.shake = false; // false is to disable vibration special effects
document.body.addEventListener('inp ut', POWERMODE);
</script>

Note: This WordPress input effect is only used when commenting, so in order not to load these JS files randomly, it is recommended to add a judgment to these codes to determine whether they are article pages or pages, and then load these codes.

If there is no such judgment condition in the footer.php file of the theme used, it is recommended to use the following code:

 
 

1
2
3
4
5
6
7
8

<?php if (is_single() || is_page() ) { ?>
<script src="<?php bloginfo('template_directory'); ?>/js/activate-power-mode.js "></script> <script> POWERMODE.colorful = true; // ture is to enable fireworks special effects POWERMODE.shake = false; // false is to disable Vibration effects document.body.addEventListener('input', POWERMODE); </script>
<
?
php
}
?
>

If there is already a judgment condition code <?php if (is_single() || is_page() ) { ?>, you only need to add the code of the second step in it.

Note: If the path uploaded in the first step is not in the JS folder, remember to modify the path when referencing the activate-power-mode.js file in the second step.

Or download another JS: https://github.com/cnguu/Bomb-Typecho-Plugin

Guess you like

Origin blog.csdn.net/winkexin/article/details/131838226