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:

Code:

%INCLUDE{"Personalpages.JavaScriptToggleImagesPeterZumbruch"}%

<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);">

Example

Click on the picture below and enjoy!

-

JavaScript Code

%STARTINCLUDE%
<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;
   }
   else
   {
      nW = iWideLarge;
      nH = iHighLarge;
   }
   whichImage.style.width  = nW;
   whichImage.style.height = nH;
}
-->
</script>
%STOPINCLUDE%

-- PeterZumbruch - 03 Sep 2007
Topic revision: r1 - 2011-05-12, PeterZumbruch - This page was cached on 2021-10-18 - 23:08.

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 (german) | Privacy Policy (german)