Changing CSS attributes on a specific product page - xmpie-users/uStore-js GitHub Wiki

Some customers have a particular product where they want or need to change one or more CSS attributes on the product page.

This JavaScript detects the page title (which uStore changes based on the site section and on the product) and enables you to change specific CSS attributes based on the page title.

Therefore, this example enables you to change the CSS for a particular product in the store.

This JavaScript changes the background of the contentArea div to a JPG rather than the default white background - but only for a specific product:

<script type="text/javascript">
  $(document).ready(function (){
    var pageTitle = document.title;
    if (pageTitle = "YOUR TITLE") //change to the title of your page
    {
      //change to the id or class of the object you want to change, and set the requied css attribute
      $("#contentArea").css("background","url(/uStore/Imags/skinName/image.jpg) no-repeat 0 0");
    } else {
      $("#contentArea").css("background-color","#ffffff");
    }
});
</script>

For information on how to add JavaScript to your store: How to add JavaScript to a storefront.

⚠️ **GitHub.com Fallback** ⚠️