I have a welcome animation on my website file that is all contained in one CSS file. How can I have this CSS file load only once per session?
I am using Wordpress, and I have got the animation linked inside a header file which only loads on the homepage. I only want this CSS file to load once, so that when the user clicks back onto the homepage, the CSS file does not load.
I understand I will have to set a cookie but I'm not sure what the best way of doing this is. I hope someone can point me in the right direction, thank you
EDIT: Here is some code I have attempted, using jquery.cookie.js. My code is throwing the error:
Uncaught TypeError: ("<link/>" , (intermediate value)(intermediate value)(intermediate value)).appendTo is not a function
Code -
jQuery(document).ready(function() {
if (jQuery.cookie('noShowWelcome')){}
else {
jQuery(("<link/>", {
rel: "stylesheet",
type: "text/css",
href: "http://le1dev.co.uk/pureretail/1/wp-content/themes/le1-web-package-a/library/css/header-animation.css"
}).appendTo("head"));
jQuery.cookie('noShowWelcome', true);
};
});