![]() |
Scale up images onclick
I'm cluelessly trying to piece together a personal site, I’ve hunted around and can’t find this covered on here... I think it used to be bad practice to resize an image with code but SVG files render beautifully at any scale and I’d like to try this out:
I’d like to have a series of images, each one doubling in scale when clicked then returning to its original size when clicked a second time. Could I use transform: scale(2) somewhere in there to make it extra streamlined? Thanks for reading! |
Have a look at the many excellent scripts at http://www.vicsjavascripts.org.uk/
All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit. |
Hey - thanks for helping! I might be after something a bit less clever though. I found this, which is close:
Code:
<script type="text/javascript">Code:
<img src="example.svg" onclick="toggle(this)"/> |
Thanks iBall - that sounds about right but I don't know where to start with scripting it, I'm sorry... Are there any examples I could look at? And does this method invoke a generic actual width and doubling or does it require information to be gather about each image? I was hoping for the former but I'm clueless enough not to know if that's possible... Thanks again!
|
Thanks iBall - this works nicely: http://www.suresure.co.uk/Temp/ICA.html
I've applied the function to all images (this suits me): Code:
window.onload=function(){Code:
<style type="text/css">And yet another question! I'd like to introduce a change of cursor - I've added this to the first image: Code:
<img src="ICA 5.svg" OnMouseOver="this.style.cursor='pointer';" OnMouseOut="this.style.cursor='auto';"/> |
Alright, I'm an idiot - this will work for the pointer cursor over images:
Code:
cursor: pointer;But is the rest tidy enough? I get anxious when I don't have a handle on what it all means - this: Code:
<script type="text/javascript"> |
| All times are GMT +1. The time now is 10:08 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.