Extensions
The freely usable 'Mobile Touch Slider' SWIPER ➔ https://swiperjs.com has been provided with four extensions.
Extension 1:
The HTML code for the individual images is generated automatically. A reference to the directory with the images is sufficient. In autoplay mode, an individual display time for each image is possible.
Extension 2:
Additional image descriptions are displayed outside the slider. They switch synchronously to the images. The image descriptions are automatically read from a simple text file (.txt). A reference to the text file is sufficient.
Extension 3:
A double click on the slider switches the full screen mode on and off. In full-screen mode, the pure images can be viewed without the image descriptions.
Extension 4:
A stationary mouse cursor over the image will be hidden.
Instructions
The slider is added to your own website with the following steps:
Step 1:
Upload the hbSlider folder to the web space.
Step 2:
In the <head> tag add the lines
<link rel="stylesheet" href="https://cdn.jsdelivr.net/ npm/swiper@9/swiper-bundle.min.css" />
<link rel="stylesheet" href="hbSwiper/css/swiper.css" />
<link rel="stylesheet" href="hbSwiper/css/mySwiper.css" />.
In the <body> tag add the line
<?php include "hbSwiper/php/hbSwiper_1.php"; ?>
at the desired position.
Add the line
<?php include "hbSwiper/php/scripts.php"; ?>
before the closing </body> tag.
Step 3:
Create a folder with the images and enter the path to this folder in the file named 'hbSwiper/php/init_1.php' in the '$imgFolder' variable.
Step 4:
Create a text file (.txt) with the image descriptions and enter the path to this file in the file named hbSwiper/php/init_1.php in the $textFile variable.
In the text file, each line begins with the filename of an image. After the file name follows a tab character as a separator for the image description and then the text of the image description. The image description ends with a line feed (ENTER key). The image description can also consist of HTML code. The order of the picture descriptions is arbitrary.
Step 5:
Make the settings for Swiper in the files named hbSwiper/script/init-swiper.js and hbSwiper/script/swiper_1.js.
Step 6:
Possibly adapt the styles in the files named hbSwiper/css/mySwiper.css and hbSwiper/css/swiper.css.
More information
If you want an individual display time for some images in autoplay mode, you can append two underlines and a number to the file name of the image in question, which indicates the display time in milliseconds. For example, change "birthday.jpg" to "birthday__5000.jpg". This addition may be missing in the text file with the image descriptions. So you don't have to change the image descriptions file every time you try out different display durations.
If no image descriptions are to be displayed, an empty string is assigned to the $textFile variable in the hbSwiper/php/init_1.php file. In the hbSwiper/css/mySwiper.css file, min-height=0 is set for the #myImgDescription_1 element.
If you generally do not use image descriptions, but want to import the images automatically from a directory, you can download a slimmer version of the hbSwiper without the functionality for image descriptions:
➔ Download example without image descriptions (last updated: 2023-02-20)
Multiple sliders on one page
An example with two sliders on one page can be seen here:
➔ See example 2