我想僅在1280 x 800分辨率的表格中顯示圖像(可以是任何尺寸),它不會在其他屏幕上顯示。HTML僅適用於特定分辨率的圖像
現在我在身體內使用<img>
元素,如果圖像很小,它不會填滿屏幕,如果圖像很大,它會將其顯示在屏幕外。
因此,HTML是這樣的:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Mapa</title>
<script type="text/javascript" src="js/jquery-3.2.1.min.js"></script>
<script src="/libs/qimessaging/1.0/qimessaging.js"></script>
<script type="text/javascript" src="js/senaletica.js"></script>
</head>
<body>
<img id="mapa" alt="mapa" src="">
</body>
</html>
和JavaScript:
$('document').ready(function(){
var session = new QiSession();
session.service("ALMemory").done(function (ALMemory) {
ALMemory.subscriber("PepperQiMessaging/totablet").done(function(subscriber) {
subscriber.signal.connect(toTabletHandler);
});
});
function toTabletHandler(value) {
var imgMap = $('#mapa');
imgMap.attr('src', 'data:image/png;base64,' + value);
imgMap.width($('window').width());
imgMap.height($('window').height());
}
});
我不此刻使用任何CSS。
你必須使用CSS爲此處理圖像寬度 –