Archived topic
back to top button
7 replies · Started by ian on February 4, 2016
the back to top button in my opinion
turns on too late when scrolling down and turns off too early when scrolling up
it is shown next to "Smooth Page Scroll to Top" plugin
Minor point but thought I would point it out
Also is it possible to change the icon used for this ?
Ian
I agree that the plugin comes on a fraction earlier then the built-in one but maybe too soon, before you need to go 'top'?
Overall it seems to work ok on Chrome - for me anyway.
I included some filters in this feature so these values can be adjusted: https://generatepress.com/knowledgebase/filter-list/
generate_back_to_top_scroll_speed
Default: 400
generate_back_to_top_start_scroll
Default: 300
For example:
add_filter( 'generate_back_to_top_start_scroll', 'generate_back_to_top_start_scroll' );
function generate_back_to_top_start_scroll()
{
return 100;
}
Adding PHP: https://generatepress.com/knowledgebase/adding-php-functions/
Let me know if you need more info :)
thanks very much
never tried adding my own php before but it all went very well
works perfectly now
thanks for your help/advice
you didn't say if it is possible
to change the icon used for this ?
Ian
Just found this flter
generate_back_to_top_icon
so forget above question
Ian
can't get change back_to_top_icon filter to work
this is the code I am trying
generate_back_to_top_start_scroll works
generate_back_to_top_icon doesn't
add_filter( 'generate_back_to_top_start_scroll', 'generate_back_to_top_start_scroll', 'generate_back_to_top_icon');
function generate_back_to_top_start_scroll()
{
/* make back to top appear sooner when down, later when up */
return 100;
}
function generate_back_to_top_icon()
{
/* change icon */
return 'fa-hand-o-up';
}
any idea what I am doing wrong
Ian
Hi Ian,
You're forgetting the add_filter call:
add_filter( 'generate_back_to_top_icon','generate_back_to_top_icon' );
function generate_back_to_top_icon()
{
return 'fa-hand-o-up';
}
Hi Tom
Thanks for that it works :)
Ian
