
Originally Posted by
clowes
I feel quite bad because I am being pretty unhelpful

Don't worry about it.
Just please keep me updated.

Originally Posted by
clowes
Essentially if you could design it around any old image that would be great, and then when I have the images I can simply replace them in the code...
OK, that'll work.

Originally Posted by
clowes
Im not sure which is easier, but I am open to either swapping images (I.E Having two images, one highlighted, one normal)
OR
Having one image, and on click the opacity changes.
Since you need to have several tints available, I would say the latter would be far less time-consuming, and the JavaScript to lay one image over another is fairly simple. (You need to understand the 'prototype' property for my implementation, though.)
Here's the essential JavaScript... (You mainly need to pay attention to the window.onload function at the bottom.)
Code:
function Card(img){
if(typeof(img) == 'string'){
img = document.getElementById(img);
}
this.image = img;
this.tint = document.createElement('img');
this.tint.style.display = 'none';
document.body.appendChild(this.tint);
var obj = this.image;
//http://www.quirksmode.org/js/findpos.html
var x = y = 0;
while(obj.offsetParent){
x += obj.offsetLeft;
y += obj.offsetTop;
obj = obj.offsetParent;
}
this.tint.style.position = 'absolute';
this.tint.style.left = x;
this.tint.style.top = y;
}
Card.prototype = {
coverWith: function (tintSrc){
if(tintSrc){
this.tint.src = tintSrc;
this.tint.style.display = 'block';
}else{
this.tint.style.display = 'none';
}
}
};
window.onload = function (){
var card = new Card('card');
card.coverWith('red.jpg');
};
That assumes an image tag similar to this:
Code:
<img src="card.jpg" id="card">
Bookmarks