I got such code:
$('.mainp').find('A[href$=jpg]','A[href$=jpeg]','A[href$=gif]','A[href$=png]').fancybox();
And it works only for .jpg files. When I change it to:
$('.mainp').find('A[href$=png]').fancybox();
It works for .png files. So what I'm doing wrong, that fancybox() is not working with all type of files?