Javascript delay/resizing
Javascript delay/resizing
您好,我想缩小图像并调整大小,同时将其保持在同一个位置(页面居中),我想使用 javascript 来完成此操作。我希望这发生在 onclick 事件上。如果您需要在此处查看我的代码 http://cannonmc.net/ .
为了进一步了解我 want/need 查看 http://orteil.dashnet.org/cookieclicker/ 的内容,我想对我的图像做同样的事情,就像你 hover/click 在那个 cookie 上发生的事情一样:)。
谢谢
卢克
我为你做了一个非常简单的例子,希望对你有所帮助。
var image = document.getElementById('image');
image.onmousedown = function() {
image.style.width = "47%";
};
image.onmouseup = function() {
image.style.width = "";
}
JavaScript 就够了,还有 CSS。
这里的工作示例:
http://jsfiddle.net/zy96xqc7/2/
您好,我想缩小图像并调整大小,同时将其保持在同一个位置(页面居中),我想使用 javascript 来完成此操作。我希望这发生在 onclick 事件上。如果您需要在此处查看我的代码 http://cannonmc.net/ .
为了进一步了解我 want/need 查看 http://orteil.dashnet.org/cookieclicker/ 的内容,我想对我的图像做同样的事情,就像你 hover/click 在那个 cookie 上发生的事情一样:)。
谢谢
卢克
我为你做了一个非常简单的例子,希望对你有所帮助。
var image = document.getElementById('image');
image.onmousedown = function() {
image.style.width = "47%";
};
image.onmouseup = function() {
image.style.width = "";
}
JavaScript 就够了,还有 CSS。 这里的工作示例: http://jsfiddle.net/zy96xqc7/2/