There are a few issues with your jQuery code:
Firstly, make sure to use addClass
instead of addclass
. Javascript is case-sensitive.
Secondly, the selector $('.kenburns')
targets the parent div, not the image itself. You should target the image specifically in order to apply the CSS transform correctly. Use this selector instead:
$('.kenburns img')
Alternatively, for better performance, you can also use
$('.kenburns').children('img')
Lastly, when using addClass
, remember to pass the CSS class name ("zoom") as an argument, not the CSS selector ("img.zoom").
Here is the corrected code:
$(document).ready(function () {
$('.kenburns').on('click', function () {
$('.kenburns img').addClass('zoom');
});
});
View the working example on JSFiddle