Toggle Images

This JavaScript-function (by Simon Lang) enables you to switch between 2 different sizes of a picture , toggled by a click:

Code:
<script type="text/javascript" src="http://www-hades.gsi.de/tools/js/onclickZoomImage.js"></script>
<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);">


NEW & UPDATED
Instead of using an external adress outside the Wiki Simon suggests to use the %INCLUDE{...}% feature by putting the JavaScript Code into an own page an reference this via %INCLUDE{...}%

Following this idea JavaScriptToggleImagesPeterZumbruch contains now the code fragment which is now included via %INCLUDE{...}% . Using this method you will find in this new topic SandboxJavaScriptToggleImagesViaIncludePeterZumbruch.

Click on the picture below and enjoy!

-

-- PeterZumbruch - 02 Mar 2006

I Attachment Action Size Date WhoSorted ascending Comment
onclickZoomImage.jsjs onclickZoomImage.js manage 378 bytes 2006-03-01 - 19:03 PeterZumbruch <nop>JavaScript</nop> source for zoomToogle
This topic: Homepages > WebHome > HomepagePeterZumbruch > SandboxJavaScriptToggleImagesPeterZumbruch
Topic revision: 2006-08-04, PeterZumbruch
Copyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki Send feedback | Imprint | Privacy Policy (in German)