我正在做一个自定义图库,当你点击一个div时它改变了div的src,所以我这样做:
function change2dd1() {
$("div.videoSel > img").attr("class", "joanamid");
$("div.videoSel > img").attr('src', $('.videoSel2 > img').attr('src'));
}
我也尝试更改img的类,这样当我点击它时,我会得到一个全屏版本,我用它:
$('.Fullscreen').css('height', $(document).outerWidth() + 'px');
//for when you click on an image
$('.joanamid').click(function () {
var src = $('.joanafull').attr('src'); //get the source attribute of the clicked image
$('.Fullscreen img').attr('src', src); //assign it to the tag for your fullscreen div
$('.Fullscreen').fadeIn();
if(imgChecker.height() > imgChecker.width()) {
$(".Fullscreen img").css({"display":"block", "margin":"5% auto","z-index":"20","top":"0", "width":"30%",
"height":"40%"});
}
});
问题是更改类根本不起作用,它保持与div首先拥有的相同的类。有什么建议吗?