Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Assuming you want to do everything client-side, store the color scheme value in a querystring:</p> <pre><code> var _colorScheme; function getQueryStringParam(paramName) { queryString = window.location.search.substring(1); queryStringParams = queryString.split("&amp;"); for(i=0;i&lt;queryStringParams.length;i++) { param = queryStringParams[i].split("="); if (param[0] == paramName) return param[1]; } } $(document).ready(function() { _colorScheme = getQueryStringParam("color"); }); $('a').click(function(){ var prefix = $(this).attr("class"); $('img.swap').each( function() { if($(this).data('prefix') != prefix){ this.src = $(this).data('current_image').replace('.gif', (prefix)+'.gif'); $(this).data('prefix', prefix); // remember the new color scheme _colorScheme = prefix; } else { this.src = $(this).data('current_image'); $(this).data('prefix', '') } }); }); // attach querystring to link's href attribute so that it is passed to the next page var href = $(this).attr('href'); $(this).attr('href', href + '?color=' + prefix); }); </code></pre> <p>Now that you have <code>_colorScheme</code> set on document ready, you can use that to set your image prefixes. At the same time, you will need to use jquery to select each link and attach a querystring to their href tags. For example, <code>&lt;a href="page.html"&gt;</code> will become <code>&lt;a href="page.html?color=red"&gt;</code>.</p> <p>A better alternative is to store the color scheme in a Session variable, which is possible with server-side scripting in php, asp, or .net.</p>
    singulars
    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.
    1. This table or related slice is empty.
    1. VO
      singulars
      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