Disable the firefox default image resizing
How to Disable the firefox default image resizing behavio开发者_运维问答ur using jquery.
I'm pretty sure you are talking about the automatic image resizing when you open an image which is bigger than your browser window.
That means if you go to www.blabla.com/verybigimage.jpg
the image is automatically resized by Firefox.
This behavior can simply not be overwritten with any kind of jQuery.
The only way to disable that automatic resizing is to go to about:config
in your Firefox and set browser.enable_automatic_image_resizing
to false
.
The only way to have control over these images is by embedding them into some kind of server side code.
Firefox will only resize an image if you access that image directly, not as part of a page. Which in turns means that if you access the image directly, there is no way to load jQuery to begin with.
So if I understood correctly what you're asking, the short answer is you can't.
EDIT:
Since you're loading the images in an iframe
, you can either make sure that the image is small enough to fit inside the iframe
OR, make sure the iframe
is large enough so that images inside it are not resized.
However, if your layout doesn't allow this, then your only option would be to write a server-side script which will serve the image wrapped in an img
tag, like others suggested. Not sure what programming language you're using, but in PHP you could do it like:
<?php
if(isset($_GET['img'])) {
echo '<img src="path/to/your/images/folder/'.$_GET['img'].'" />';
} else {
echo 'Must specify an image';
}
?>
Save this as showimage.php
and then call it like showimage.php?img=yourimage.jpg
.
Hope this helps.
To get around this, a lot of websites link to a page that does nothing but display the given image, rather than link directly to the image itself.
Alternatively, you can do what a lot of gallery scripts do: intercept the click event and display a dynamically generated HTML block that wraps the image.
I fixed this with the following code
$("#iframe").contents().find("img").attr('height','');
$("#iframe").contents().find("img").attr('width','');
To disable image resizing in firefox i have try following code and it work. Try it may help you.
document.designMode = "off";
document.execCommand("enableObjectResizing", null, "false");
design mode set off because it does not affect any other functionality like contenteditable.
精彩评论