Epics@GSI Webhome

JavaScript Toggle Image size

By including this topic JavaScriptToggleImages via %INCLUDE{...}% this JavaScript-function (by Simon Lang) enables you to switch between 2 different sizes of a picture, toggled by a click:



<img src="http://hades-wiki.gsi.de/pub/SimAna/PairsNov02/N_ep_em_gen4_ABC.gif"
width='500px' height="200px" onclick="zoomToggle('200px','200px','500px','500px',this);">
The syntax is
     <img src="A" onclick="zoomToggle('iWideSmall','iHighSmall','iWideLarge','iHighSmall',this);">


Click on the picture below and enjoy!


JavaScript Code

<script type="text/javascript">
function zoomToggle(iWideSmall, iHighSmall, iWideLarge, iHighLarge, whichImage)
        oW = whichImage.style.width;
        oH = whichImage.style.height;
        if ((oW==iWideLarge)||(oH==iHighLarge))
                nW = iWideSmall;
                nH = iHighSmall;
                nW = iWideLarge;
                nH = iHighLarge;
        whichImage.style.width  = nW;
        whichImage.style.height = nH;


-- PeterZumbruch - 03 Sep 2007
Topic revision: r1 - 2011-05-12, PeterZumbruch
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding GSI Wiki? Send feedback
Imprint (in German)
Privacy Policy (in German)