With jQuery, i change the src of an image on click
$("#thumb li img").click(function() {
var newlinkimage = $(this).attr("src");
newlinkimage = newlinkimage.substring(14,17);
$("#avant img").attr("src", 'retouche-hr' + newlinkimage + '-a.jpg');
$("#apres img").attr("src", 'retouche-hr' +newlinkimage + '-b.jpg');
The problem is, that the NEW image width is different that the old. HOW do i get the NATIVE width of the new image (like the little arrow that get that in dreamweaver
This is the plain javascript way to do it. It should be easy to integrate this into your code.
var newimage = new Image();
newimage.src = 'retouche-hr' + newlinkimage + '-a.jpg'; // path to image
var width = newimage.width;
var height = newimage.height;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With