⇑ Top
|
<
div
class
=
"leftbar-wrap"
>
<
a
href
=
"#0"
id
=
"scroll-back"
>
<
span
class
=
"active-area"
>
<
span
class
=
"bar-desc-niz"
>⇓Back<
/
span
>
<
/
span
>
<
/
a
>
<
a
href
=
"#"
class
=
"left-controlbar"
>
<
span
class
=
"active-area"
>
<
span
class
=
"bar-desc-top"
>⇑Up<
/
span
>
<
/
span
>
<
/
a
>
|
You can place it at the very bottom of the site, before the closing tag. in the footer.php file.
Then we register the design styles in our style file (style.css) and upload all the changed files to the hosting. Here are the styles.
/* description of the container */ .leftbar-wrap ( position: fixed; height: 100%; top: 0; width: 99px !important; left: 0; ) /* description of the top button */ .left-controlbar ( height : 100%; display: block; text-decoration: none; ) /* back button description */ #scroll-back ( display: block; height: 100%; top: 0; display: none; text-align: center; ) /* background color column description for both buttons */ .active-area ( width: 100px; height: 100%; display: block; text-align: center; ) /* set background color transparency when hovering over active area page */ .leftbar-wrap:hover .active-area ( background: #E1E7ED !important; opacity:0.7 !important; ) /* make the highlight a little brighter when hovering over the label */ .leftbar-wrap .active-area:hover ( ) /* center the label on the buttons */ .bar-desc-niz ( top: 26% !important; position: relative; display: inline-block; ) .bar-desc-top ( top: 10% !important; position : relative; display: inline-block; )
|
/* container description */ leftbar wrap ( position : fixed ; height : 100% top : 0 ; width : 99px !important ; left: 0 /* description of the "Up" button */ left-controlbar ( height : 100% display : block ; text-decoration : none /* description of the "Back" button */ #scroll back ( display : block ; height : 100% top : 0 ; display : none ; text-align : center ; /* description of the background color column for both buttons */ active-area ( width : 100px height : 100% display : block ; text-align : center ; /* set the transparency of the background color when hovering over the active area of the page */ Leftbar-wrap:hover .active-area{
background : #E1E7ED !important ; opacity : 0.7 !important ; /* make the highlight a little brighter when hovering over the caption */ Leftbar-wrap .active-area:hover{
/* center the label on the buttons */ bar-desc-niz ( top : 26% !important ; position : relative ; display : inline-block ; bar-desc-top ( top : 10% !important ; position : relative ; display : inline-block ;
|
Depending on the design and structure of your resource, you will need to slightly change some of the parameters in these styles. For example, in lines 47 and 53, change the indentation of the words "Back" and "Top" from the very top of the page, respectively
After editing all the files, we can safely upload them to the hosting and this method will work. You can see its implementation on my blog. Do it for your health.
We move on to the next method. This option will already contain a simple button in the lower right area of the screen, clicking on which will move the top of the page.
The third way of the button to the top without a plugin
The implementation of the button is also very simple and works 100% on a WordPress site. As for the HTML of the site or another engine, I can’t say. Test.
You need to copy the following code with the script to the very bottom of the site before the closing tag/
JavaScript
|
<
p
id
=
"back-top"
>
<
a
href
=
"#top"
>
<
span
>
<
/
span
>
<
/
a
>
<
/
p
>
|
The back to top button is now present in many sites and helps users quickly return to the very top of the page. This is quite convenient if the site displays a lot of information. Therefore, so that each time you do not have to scroll the web page back to the beginning of the article or to the menu, developers advise adding an up button. It is located, as a rule, in the lower right corner and appears as it approaches the end of the page. The option is quite interesting and not so difficult to implement.
You can, in principle, create a button to the top using certain scripts and editing the WordPress template, but there is an easier option - plugins. It is ideal for those who are too lazy to understand the code, or those who are poorly versed in web development issues. In addition, the modules have different settings for the implementation of various interesting features. And this, too, you will agree, is very useful. Of the 10 plugins found for the Back to top feature, I will only consider 4 that have a sufficient number of downloads and correspond to the current versions of the WordPress system.
Smooth Scroll Up
The lightweight and highly customizable Smooth Scroll Up plugin allows you to add an up button to any post/page in WordPress. The module has been downloaded more than 40 thousand times, WP versions from 3.2 to 4.1 are supported. The last update was just recently. There are translations into different languages (Russian, Ukrainian yet).
Key features of Smooth Scroll Up:
- Selecting different elements for the up button: text, image, button.
- Position selection for the Back to top element: left, right, center.
- Ability to specify any text for the top button.
- Specifies the distance from the top of the page after which the button appears.
- Animation when scrolling (scrolling, dimming).
- Show/hide on homepage and mobile devices.
- Adding an event on click.
Here are the parameters for the top button (color, border, background, transparency), and setting the location of the Back To Top element, and using pictures or text for it, plus animation options when scrolling, etc. Supported versions of WordPress are from 3.0 to 3.9.2, the module has been downloaded more than 18 thousand times.
Of these four top button plugins, I would advise you to choose. Their order in the review is not a rating, that is, it does not mean that I considered the best ones at the beginning or at the end of the article, they go as they become familiar. Everything, in principle, depends on your needs. If you are generally far from development and WordPress, then the easiest thing is to install Smooth Scroll Up and forget it. For those who want to tinker with the settings, the last two plugins will do. The first one is the newest at the moment. In general, there are plenty to choose from.
Hi all! When this blog was just starting out, I didn’t even think about such a convenient feature as scrolling the page up with one button. But, when voluminous articles appeared, I realized that such a button was sorely lacking. Who likes to scroll back up the entire article? Do up button turned out to be quite easy. There are two options here: the first is to use ready-made scripts, the second is to download the plugin. But first things first.
First, I made a static button in the footer of the site. It was a simple arrow image with a link. That is, it turned out that when you clicked, the page instantly jumped up, and a lattice was added to the site address. This, of course, is far from the best way, but the button looked nice, up lifted, so it fulfilled its function. The motto of the programmer: "It works - do not touch!"
However, after some time, I came to the conclusion that you still cannot do without a floating button. Moreover, I have seen such “up” buttons on many reputable (and not so) sites. So it is much more convenient to view the material, one click on the button - and the page instantly rises back up. And usability is an important factor in the design of any website.
Floating up button: how to add it using a plugin
Scroll To Up Plugin: Up button for easy navigation. Up Button in WordPress
As I said, the up button on the site can be added using scripts, using CSS and jQuery. On many sites, this is how it is implemented. But for WordPress, there is an easier way - the Scroll To Up plugin. It has various “up” buttons in ready-made variations. I love the convenience of a WordPress site – you can find plugins for just about anything!
Download Scroll To Up, with which we will add this very “up” button, through the WordPress console, then go to the settings. We see several tabs.
Here you can set the speed of scrolling up the page when you click on the button, the animation of the appearance Online, its position on the page. And most importantly - the type of button. This can be plain text, an icon, or an image of the up button, which you can choose from pre-made or upload your own. The plugin has a sufficient number of built-in button options.
If you don't like any of the proposed buttons, you can specify the path to any image in the Your Own Image tab.
The other tabs set the background color, font size and color, style. Each tab corresponds to a certain type of button. As you can see, customizing the button to perfectly fit your site is easy. Everything is quite simple and clear.
I even got into the code of the plugin itself and rounded the edges of the button so that it would look harmonious with my design, and the site became prettier. After digging into the code, you can mock the buttons as you like. Of course, no one forbids using scripts for WordPress, but the plugin is much easier to learn.
What a pity that there is no such function for managing your site: you poked it, and the pages themselves climbed up to the top of the search results
Hello dear site readers! I present to you and your attention a new post in which I will talk about what the “Back to Top” button is for and how to install it on WordPress. Well, in the beginning, as always, I will explain why this button is needed at all and whether it is worth putting it. Let's get started!
What is the top button for?
For example, you wrote a long article, the user has read it to the end and now wants to go back to the beginning. I think it's a familiar situation. Is not it? And turning the mouse wheel and “pulling” the slider is not very convenient and takes a long time.
That is why this function was created - raising the page to the top. And also, if the button is beautifully designed, then this is a plus for the design! And if you modify it, then it will be possible to release the page down when pressed, i.e. vice versa. That's it.
Raising the page can be done both with the help of the plugin and without it. I will now explain both. So be careful.
Installing a Button with a Plugin
The first thing to do is to activate it. Then the button will start working. But, the image of the button will be standard. I advise you to change it to your own. For this:
- Go to the "Settings" tab
- —> Scroll to Top
- And choose the appearance of the button from the proposed ones or upload your own
- Click the "Update Options" button
- Ready! The back to top button for WordPress has taken on a new look
Like this. You can also customize it, namely:
- Location
- Indentation
- Speed
- and other
Back to top button without plugin
We will now look at how to top button for wordpress without using third party plugins. Why no plugin? But because plugins slow down the site. I have already said this more than once (In the article - Adding Videos to WordPress) and I will say more and more.
To make a button, follow the instructions below:
1. Open the file footer.php, which is located in the folder with the template, and paste before
code:
Just make some changes, namely:
- where your_site.ru is written - write the address of your site
- where is the path to the image - enter the path to the image that will be the button
- where image is the name of the image. If not .jpg, then change to the format that is set in the picture.
2. Open the file style.css, which is also located in the template folder, and at the very end, paste the following code:
#toTop ( width: 100px; text-align: center; padding: 5px; position: fixed; bottom: 10px; right: 10px; cursor: pointer; color: #666666; text-decoration: none;)
3. Download and extract it. It contains a file verx.js, which you need to throw in the root of your site.
4. Open the file functions.php located in the folder with the template and type in the code there:
// smart jquery inclusion if (!is_admin()) ( wp_deregister_script("jquery"); wp_register_script("jquery", ("//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" ), false); wp_enqueue_script("jquery"); )
5. Well, that's all! I can congratulate you, now your site has a button to the top for wordpress.
You have just read the article “Back to Top Button for WordPress” and installed it for yourself. How was it? Write in the comments! That's all for me, for now.
Sincerely, Konstantin Belan.