Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can set up two ImageStyles, both with the same dimensions. </p> <p>One is the regular, colour image, the other the filtered one. The settings should be the same (cropping etc.), except that one has the desaturation filter. You can call one setting 'logo-thumb-normal' and one 'logo-thumb-filtered'</p> <p>You should now have two output images which are the same except for the filtering, and they should have the same file name, though they will be in different folders. </p> <p>Set your content type Image field to use 'logo-thumb-filtered.'</p> <p>So, when you upload an image within a content type, that should generate two files, one for each setting:</p> <p><code>/sites/default/files/styles/logo-thumb-normal/public/field/image/image.jpg</code> and <code>/sites/default/files/styles/logo-thumb-filtered/public/field/image/image.jpg</code></p> <p>You can refer to these two images manually, as Spudley suggests, but even easier may be to use jQuery to swap the images out on hover (here's a simple example: <a href="http://jsfiddle.net/vSUkv/1/" rel="nofollow">http://jsfiddle.net/vSUkv/1/</a>):</p> <pre><code>$('.image1').hover( function () { src = $(this).attr('src'); $(this).attr('src', src.replace('filtered', 'normal')); }, function () { $(this).attr('src', src.replace('normal', 'filtered')); } ); </code></pre> <p><strong>EDIT:</strong></p> <p>To include jQuery in Drupal 7:</p> <p>To add the script above, you can:</p> <ul> <li><p>Add a custom JavaScript file to your theme, if you haven't already, by adding the line <code>scripts[] js/custom.js</code> to your theme's <code>info</code> file.</p></li> <li><p>Create the <code>js</code> folder inside your theme, and create the <code>custom.js</code> file inside that folder.</p></li> <li><p>Add the following code to your <code>custom.js</code> file: </p></li> </ul> <hr> <pre><code>// We define a function that takes one parameter named $. (function ($) { // Store our function as a property of Drupal.behaviors Drupal.behaviors.imageSwap = { attach: function (context, settings) { $('.hplogoclient a img').hover( function () { src = $(this).attr('src'); $(this).attr('src', src.replace('filtered', 'normal')); }, function () { $(this).attr('src', src.replace('normal', 'filtered')); } ); } } }(jQuery)); </code></pre> <ul> <li>Clear the cache and check again. See <a href="http://drupal.org/node/171213" rel="nofollow">http://drupal.org/node/171213</a> for details.</li> </ul>
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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