Back to Top Stack - non stack pages

I recently bought the Back to Top Stack (RWExtras) which includes the option to export code for non stacks pages. I’ve followed the instructions but can’t seem to get it to work on the standard RW blog page. I’ve included the HTML code for the button in the sidebar and added CSS and javascript as per the instructions in the stack.

Page source shows a Can’t find variable error at the beginning of the javascript (screenshot below).

Associated web page:

I’m probably doing something wrong but any assistance would be welcomed.

MacOS Catalina 10.15.2
RW 8.4.1
Stacks 4.0.3

What non-stacks page are you building?

The default RW blog page, as I mentioned in the question.

oh ok

Not familiar with the stack/non-stack and can’t make out from the screenshot but does it need to be customised for the page you want it to be on (note the this.pathname.replace) or include the <div>BacktoTopAnchorPoint that it is targeting to get back to the top?

Either could be your undefined variable

On a stacks page this stack adds a scrolling ‘back to top’ button and it’s just a matter of adding the stack and customising the button as required. From a stacks’ page it is possible to generate HTML, CSS and javascript code (displayed in preview mode when the ‘view generated source code’ is toggled) for use on a non stacks page, such as the default RW blog page. There is no reference to the need to customise the code for the page, bearing in mind that the page generating it won’t be the one where it’s used. I assume, therefore, that the code is not page dependent.

Link to product page, which might explain things better than I can.
https://rwextras.com/backtotop/

Just checked the product page again and noticed that I should have tagged this post for @willwood

In your global.js file you have entered…

<style type="text/css">.custom{color:#929292;}</style>

That is not Javascript code, that is HTML and CSS.

Because global.js is loaded before your ‘back to top’ code, this error causes all other Javascript on the page to cease working. Hence jQuery is not working and the first line of your ‘back to top’ code fails.

It should be a very simple fix, now you know what the issue is and what to look for. I strongly suspect you entered this wrong in your site settings or Page Inspector and forgot about it.

Thank you for pointing this out. However, I’ve completely removed all code from the global.js but this doesn’t seem to have resolved the problem. The back-to-top button is still not appearing and the same error is still showing when I view the Page source.

Change your

<script href="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>

to

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>

Thank you, that’s fixed it. I would point out that the code I used was produced by the stack.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.