plugins/gallery/gallery-bits.js
changeset 10 b38afb86dcad
parent 0 7caf561c50ee
child 42 7c6e2e97aa08
equal deleted inserted replaced
9:ebd7003e73c6 10:b38afb86dcad
     1 /*
     1 /*
     2  * Misc functions for Enano.Img Gallery.
     2  * Misc functions for Snapr.
     3  */
     3  */
     4 
     4 
     5 function gal_toggle(elem, img, img_open, img_close)
     5 function gal_toggle(elem, img, img_open, img_close)
     6 {
     6 {
     7   if ( !img_close || !img_open )
     7   if ( !img_close || !img_open )
     8   {
     8   {
     9     img_close = scriptPath + '/plugins/gallery/toggle-closed.png';
     9     img_close = scriptPath + '/plugins/gallery/toggle-closed.png';
    10     img_open  = scriptPath + '/plugins/gallery/toggle-open.png';
    10     img_open  = scriptPath + '/plugins/gallery/toggle-open.png';
    11   }
    11   }
    12   if ( elem.style.display == 'block' )
    12   if ( elem.style.display == 'none' || !elem.style.display )
    13   {
    13   {
    14     elem.style.display = 'none';
    14     elem.style.display = 'block';
    15     img.src = img_close;
    15     try {
       
    16       img.src = img_open;
       
    17     } catch(e) {};
    16   }
    18   }
    17   else
    19   else
    18   {
    20   {
    19     elem.style.display = 'block';
    21     elem.style.display = 'none';
    20     img.src = img_open;
    22     try {
       
    23       img.src = img_close;
       
    24     } catch(e) {};
    21   }
    25   }
    22 }
    26 }
    23 
    27 
    24 
    28