开发者

Increase size of embedded image in HTML

开发者 https://www.devze.com 2023-03-13 09:40 出处:网络
I have an HTML page. There is a base64 encoded image in it. I am planning on writing a javascript to increase the size of the image and content on the page. So everything on the page will appear bigge

I have an HTML page. There is a base64 encoded image in it. I am planning on writing a javascript to increase the size of the image and content on the page. So everything on the page will appear bigger. I am able to increase the font size but not sure about the embedded ima开发者_如何学JAVAge.


If you have

<img id="myImage" src="" />

Then you can do it like this:

$('#myImage').attr({
    width: 150,     // new width
    height: 150     // new height
});


Well, you can just adjust the css for that image or the attributes. Use either height or width, just not both so they scale properly.

Jquery:

$("img").css("width","150px");

I may be confused but don't all modern browsers support Ctrl + scroll to zoom?


With images referenced by URL, you can change height and width (either the HTML attributes or CSS styles) and the browser will resize the image. I imagine it will work the same with an embedded image.


This functionality is available in most modern browsers, and as such it is unnecessary to duplicate it using client-side scripts. Consider simply informing the user that most browsers have text size controls built in (so that they may use this tool on other sites as well).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号