This should work: (based on Brian Nickel's answer to another question)
$('#triangle').mousedown(function(e) {
e.preventDefault();
//create matching canvas representation for the image
if(!this.canvas) {
this.canvas = $('<canvas/>')[0];
this.canvas.width = this.width;
this.canvas.height = this.height;
this.canvas.getContext('2d').drawImage(this, 0, 0, this.width, this.height);
}
var pixelData = this.canvas.getContext('2d').getImageData(e.offsetX, e.offsetY, 1, 1).data;
//check that the pixel is not transparent
if (pixelData[3] > 0) {
//your code
}
});
Working example: http://jsfiddle.net/FCf9d/
This solution assumes there are no transparent pixels inside the triangle.
This example uses the jsfiddle logo instead of a triangle, because you can't use remote images. The jsfiddle-logo works because it's on the jsFiddle-domain but any other random image doesn't work.
But that shouldn't be a problem once you implement the code on your own website.
I took the liberty of adding the move-function to the fiddle for you so you could see everything in action. If you like my script and would like to add boundaries to the move area, check out another fiddle of mine which has those build in: http://jsfiddle.net/SN8Ys/