Ignore:
Timestamp:
10/15/08 16:06:51 (4 years ago)
Author:
hverton
Message:

fixed resizing issue with IE6/IE7

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/modules/album_panels/templates/modules.album_panels.random_image_panel.tpl

    r1804 r1852  
    1616{***************************************************************************} 
    1717{include file="_openside.tpl" name=$_name title=$_title state=$_state style='side-body-nm'} 
    18 <div style='width:100%;text-align:center'> 
     18<div id='random_image_div' style='text-align:center;margin:0;padding:0;'> 
    1919    {if $image.album_id} 
    20         <a href='{$smarty.const.BASEDIR}albums.php?type=photo&action=view&album_id={$image.album_id}&photo_id={$image.photo_id}'><img width='100%' style='margin:0;padding:0;' class='' src='{$smarty.const.PHOTOS}{$image.photo_sized}' alt='{$image.album_photo_description}' title='{$image.album_photo_description}' /></a> 
     20        <a href='{$smarty.const.BASEDIR}albums.php?type=photo&action=view&album_id={$image.album_id}&photo_id={$image.photo_id}'><img id='random_image' width='10' style='margin:0;padding:0;' class='' src='{$smarty.const.PHOTOS}{$image.photo_sized}' alt='{$image.album_photo_description}' title='{$image.album_photo_description}' /></a> 
    2121    {/if} 
    2222    {if $image.gallery_id} 
    23         <a href='{$smarty.const.BASEDIR}albums.php?type=photo&action=view&gallery_id={$image.gallery_id}&photo_id={$image.photo_id}'><img width='100%' style='margin:0;padding:0;' class='' src='{$smarty.const.PHOTOS}{$image.photo_sized}' alt='{$image.gallery_photo_description}' title='{$image.gallery_photo_description}' /></a> 
     23        <a href='{$smarty.const.BASEDIR}albums.php?type=photo&action=view&gallery_id={$image.gallery_id}&photo_id={$image.photo_id}'><img id='random_image' width='10' style='margin:0;padding:0;' class='' src='{$smarty.const.PHOTOS}{$image.photo_sized}' alt='{$image.gallery_photo_description}' title='{$image.gallery_photo_description}' /></a> 
    2424    {/if} 
    2525</div> 
    2626{include file="_closeside.tpl"} 
     27<script type='text/javascript'> 
     28{literal} 
     29// Dean Edwards/Matthias Miller/John Resig 
     30function init() { 
     31    // quit if this function has already been called 
     32    if (arguments.callee.done) return; 
     33 
     34    // flag this function so we don't do the same thing twice 
     35    arguments.callee.done = true; 
     36 
     37    // kill the timer 
     38    if (_timer) clearInterval(_timer); 
     39 
     40    // needed inside the loop 
     41    var parent_left = 0; 
     42    var parent_width = 0; 
     43    var obj = 1; 
     44    var i = 1; 
     45 
     46    if (document.getElementById("random_image_div") != null) { 
     47        // get the info about the objects parent 
     48        obj = document.getElementById("random_image_div").parentNode; 
     49        // fall back gracefully if the parentNode can not be found 
     50        if (obj == null) obj = document.getElementById("random_image_div").offsetParent; 
     51        // adjust the width of the image 
     52        document.getElementById("random_image").style.width = obj.offsetWidth + "px"; 
     53    } 
     54}; 
     55 
     56/* for Mozilla/Opera9 */ 
     57if (document.addEventListener) { 
     58    document.addEventListener("DOMContentLoaded", init, false); 
     59} 
     60 
     61/* for Internet Explorer */ 
     62/*@cc_on @*/ 
     63/*@if (@_win32) 
     64    document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>"); 
     65    var script = document.getElementById("__ie_onload"); 
     66    script.onreadystatechange = function() { 
     67        if (this.readyState == "complete") { 
     68            init(); // call the onload handler 
     69        } 
     70    }; 
     71/*@end @*/ 
     72 
     73/* for Safari and Konqueror */ 
     74if (/KHTML|WebKit/i.test(navigator.userAgent)) { // sniff 
     75    var _timer = setInterval(function() { 
     76        if (/loaded|complete/.test(document.readyState)) { 
     77            init(); // call the onload handler 
     78        } 
     79    }, 10); 
     80} 
     81 
     82/* other alternatives */ 
     83if (window.attachEvent) { 
     84    window.attachEvent('onload', init); 
     85} else if (window.addEventListener) { 
     86    window.addEventListener('load', init, false); 
     87} 
     88 
     89/* if all else fails try this */ 
     90window.onload = init; 
     91{/literal} 
     92</script> 
    2793{***************************************************************************} 
    2894{* End of template                                                         *} 
Note: See TracChangeset for help on using the changeset viewer.