我试着把一个图像放在全屏幕上,而且图像也可以缩放。我使用此jquery插件http://www.jacklmoore.com/wheelzoom/进行缩放,并使用此处描述的所有选项Full-screen responsive background image进行全屏显示。
在我的测试中,可以放大图像,但如果调整窗口大小,图像不会调整大小,并且在边框之间显示空格。
我不知道是否将图像放在div中,并使此div全屏。
发布于 2013-07-25 00:06:05
如果你给我们提供小提琴,我们可以做一些其他的事情,但一个选择似乎是改变窗口调整大小的图像大小:
$(window).resize(function() {
//in order to call the functions only when the resize is finished
//http://stackoverflow.com/questions/4298612/jquery-how-to-call-resize-event-only-once-its-finished-resizing
clearTimeout(resizeId);
resizeId = setTimeout(doneResizing, 500);
});
function doneResizing(){
var windowsWidtdh = $(window).width();
var windowsHeight = $(window).height();
//setting your image dimensions
$('#yourImage').css('height', windowsHeight );
$('#yourImage').css('width', windowsWidtdh );
}https://stackoverflow.com/questions/17839125
复制相似问题