There are a lot of people who want to create sites. Most users learn this on their own, using different sources. And, of course, there are concepts that future owners have not even heard of. But if you got down to business, then you need to study it thoroughly. Therefore, the article will examine in detail the question of how to make a spoiler on your resource.
We begin, naturally, with the very concept of what it is and what this object will be needed for. So, quite often on the websites there is information of various kinds, which (for various reasons) must initially be hidden from visitors. That is, itβs not that it should not be shown at all, but simply provided only at will. Here is the spoiler in html just for this and is used. It saves originally hidden content for the site. But this is not reflected in any way when ranking a resource by search engines, since for them this design is open and there is no negative influence. Any hidden information is disclosed when you click on the specified link.
In addition, how to make a spoiler, a lot of people are interested, but for what purpose is it done? Most often for the external beauty of the resource. Take, for example, a site whose main page design does not allow for the placement of large text. And the owner needs the search engines to promote the resource, so the content should be voluminous (the size of the article can play a significant role). So the creation of a spoiler comes to the rescue. Also, its use is suitable for hiding auxiliary information, or that you do not always want to read.
Not everyone wants to read them, but thereβs no getting away from them. There is a way that will help protect visitors from this reading. This is the creation of a button that hides any kind of spoiler on the forum, in the article, etc. You can create it in different ways. The easiest way is with the html code input class = "button". First, you only need to make sure that the code is inserted when adding information, and if so, the button will start working immediately after the text is inserted in the right place.
This version is suitable for a site created on Ucoz. But even after installation, the button may not work, as it requires additional settings. First of all, this is her appearance. Then, an identifier that must be unique. And finally, in the code of the page where the material should be, a script is added before the tag, which is responsible for the correct operation of the button. It is important to place it correctly, and not just know how to make a spoiler.
And now we will analyze the same function, but only for a site made for WordPress. The easiest way here is to use the Advanced Spoiler plugin, which is easy to download from many resources. Its installation is standard:
- unpacking the archive on your computer;
- connection to the site using ftp client (the most popular - Total Commander);
- uploading a file to your hosting;
- in the site admin panel, we are looking for the "Plugins - Inactive" section and activate the newly installed one. After the completed steps, it will start working. Now, adding material in any editor, both in visual and in html, the Spoiler button will be visible. Adding the necessary information between the tags [spoiler] [/ spoiler] and creates a spoiler. If the owner understands well, the plugin can be slightly reconfigured.
And another way to make a spoiler on the site. First of all, you need to connect the jQuery library and the so-called "Pribluda" JS, which is required in order for the spoiler to collapse and expand more or less smoothly. On the desired page of the site, in the administrative panel, the required code is placed between the tags. Further, so that the function is closed by default, the line .splCont {display: none; padding: 3px 5px;}. If there is no such document, it is not so scary. The inscription can be placed anywhere right in the text itself, the main thing is before the spoiler itself is placed. And finally, between ... the code for hiding information is placed.