Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to Keep Cookie Value after page refresh
    primarykey
    data
    text
    <p>I'm creating a demo panel for users to change the layout of a Wordpress theme when they arrive at my demo site. The user changes value via a select drop-down box, and a cookie is set at that time.</p> <p>I'm having trouble showing the ACTIONS that I want implement after the page is refreshed. So the cookie is saving it's value, but after page refresh my CSS actions will not stay in place. I'm not very good with jQuery so any help would be appreciated. Here's the code:</p> <pre><code>$('#montage-demo-panel select.body-style-layout').change(function () { // Apply cookie $.cookie('body-style-layout', $(this).val(), { path: '/' }); var value = $(this).val(); if (value == 'fixed') { var wrapper = $('#wrapper'); var header = $('#header'); var masthead = $('#masthead'); var branding = $('#branding'); wrapper.removeAttr('style'); header.removeAttr('style'); masthead.removeAttr('style'); branding.removeAttr('style'); wrapper.removeClass('wrapper-full purple-header-full'); header.removeClass('header-full'); masthead.removeClass('masthead-full'); branding.removeClass('branding-full'); location.reload(); } else { var wrapper = $('#wrapper'); var header = $('#header'); var masthead = $('#masthead'); var branding = $('#branding'); var mainbg = $('#main-bg'); var access = $('#access'); wrapper.removeClass('purple-header'); wrapper.addClass('wrapper-full purple-header-full'); header.addClass('header-full'); masthead.addClass('masthead-full'); branding.addClass('branding-full'); mainbg.addClass('main-bg-full'); access.addClass('access-full'); // Re-fresh page location.reload(); } }); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload