Announcement

Collapse
No announcement yet.

Alt and Title tags for additional images

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Alt and Title tags for additional images

    Hello,

    I found the following response in a thread about adding Alt and Title tags to swatches. Is there something similar that can be done with additional images (perhaps I can put the alt text manually in a custom field)?
    Thanks
    The old response follows.
    Sam

    OLD Response to thread - Alt and Title tags for swatches


    The swatches are dynamically written to the page on page load using JavaScript. You can edit the function that creates the swatches in the Admin. Go to PROD then click the Attribute Machine Tab. The last text box is the Head Template and it has a function that controls the creation of the swatches.

    To add Alt and title tags you can add the two lines below in red:


    <script>
    AttributeMachine.prototype.Generate_Swatch = function( product_code, attribute, option )
    {
    var swatch = document.createElement( 'li' );
    var span = document.createElement( 'span' ); // to vertically center the swatch images
    var img = document.createElement( 'img' );
    img.src = option.image;
    img.title = option.prompt;
    img.alt = option.prompt;


    swatch.appendChild( span );
    swatch.appendChild( img );


    return swatch;
    }
    </script>
Working...
X