Forum
How can i place a perch tag to change the the background of my website?
//backstretch
$.backstretch([
"img/wallpaper.jpg"
], {
fade: 750,
duration: 1000
});
The code above is responsible for the background of my website and is in a seperate js file.
Asad, this is likely something youll need to do in attributes template for each page... but to fully understand what your trying to do can you give an example of your expected results??
If the code needs to be in an external file, and not part of the page, you'll need to make that file manageable by Perch too.
You can read about using different file extensions here: https://docs.grabaperch.com/perch/getting-started/file-extensions/
https://www.jquery-backstretch.com/. This is the plugin I am using.
I've started to implement this but I have a few questions 1) Will I need to include perch runtime at the top as I have on the other pages. 2) How should I put the perch tag in? Should it be within the quote marks so e.g.
3) Will I have to make a new page on Perch(GUI) for this tag to show up?
Hopefully, these questions made sense.
Yes, you will.
Yes, that looks correct.
It should turn up automatically when you request the JS file from the server.
Is my htaccess file correct?
That's going to depend on your Apache configuration - is it working?
No it didn't work but then i copied and pasted the js code in a script tag on the index page and it works. However, when I upload an image through perch, it doesn't change on the website instead there's no wallpaper.
This is the js code
and this is the template I am using
Figured it out, had to change the perch template to