Advanced Search

Page 3 of 3 FirstFirst 123
Results 21 to 30 of 30

Thread: Need Expando with a Z-index

  1. #21
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    27,637
    Thanks
    42
    Thanked 2,896 Times in 2,868 Posts
    Blog Entries
    12

    Default

    I think I have all the kinks worked out. Before I start though, where you have:

    Code:
    </div><!--EndIndent-->
    </div><!--ENDCONTENT-->
    
    <hr>
    
    <br class="clearboth">
    
    <div align="center">
    I think you really want this instead:

    Code:
    </div><!--EndIndent-->
    </div><!--ENDCONTENT-->
    
    <div class="clearboth"></div>
    
    <hr>
    
    <div align="center">
    Here are the new styles:

    Code:
    .expando { position: absolute;
     visibility: hidden;
     top: 0; }
    
    .ex1 {
     left: 0; }
    
    .ex2 {
     left: auto;
     right: 0; }
    
    .excent {
     left: -52px;
     margin-left: 50%;
    }
    
    .excontainer {
     position:relative;
     float: left;
     margin: 0;
     padding: 0 2px;
     height: 137px;
     z-index: 1;
     background-position: left top;
     background-repeat: no-repeat;
    }
    #image1 {
     width:105px;
     background-image: url(images/steamed-vegetables1_tbn.gif);
    }
    #image2 {
     width:116px;
     padding-right: 0;
     background-image: url(images/steer-bathroom1_tbn.gif);
    }
    #image3 {
     width:104px;
     background-image: url(images/whipped-cream1_tbn.gif);
     background-position: center top;
    }
    #image4 {
     width:104px;
     padding-left: 0;
     background-image: url(images/new-muffler1_tbn.gif);
     background-position: right top;
    }
    #image5 {
     width:117px;
     background-image: url(images/big-A-ranch1_tbn.gif);
     background-position: right top;
    }
    Here is the new markup with an on page helper script:

    Code:
    <div class="center">
    <div class="excontainer start" id="image1">
    <img class="expando ex1" src="images/steamed-vegetables1.gif" width="105" height="137" border="0" alt="steamed vegetables cartoon 1">
    </div>
    <div class="excontainer start" id="image2">
    <img class="expando ex1" src="images/steer-bathroom1.gif" width="116" height="130" border="0" alt="steer in bathroom cartoon 2">
    </div>
    <div class="excontainer start" id="image3">
    <img class="expando ex1 excent" src="images/whipped-cream1.gif" width="104" height="137" border="0" alt="whipped cream cartoon 3">
    </div>
    <div class="excontainer start" id="image4">
    <img class="expando ex2" src="images/new-muffler1.gif" width="104" height="137" border="0" alt="new muffler cartoon 4">
    </div>
    <div class="excontainer start" id="image5">
    <img class="expando ex2" src="images/big-A-ranch1.gif" width="117" height="131" border="0" alt="Big A Ranch cartoon 5">
    </div>
    </div>
    <script type="text/javascript">
      (function(){
       var loadsure = function(i, e){
        e = e || window.event || null;
        if(e && e.type == 'load' || i.complete){
         i.parentNode.className = i.parentNode.className.replace(r2, '');
         i.style.visibility = 'hidden';
        }
        else i.onload = function(){loadsure(i);};
       }, e = document.images, l = e.length, r1 = new RegExp('\\bexpando\\b'), r2 = new RegExp(' start');
       for(var i = 0; i < l; ++i)
        if(r1.test(e[i].className))
         loadsure(e[i]);
      })();
    </script>
    <div style="clear:left;"></div>
    Here's the new script:

    Code:
    /* Expando-ZV Image Script ©2008 - 2009 John Davenport Scheuer
       as first seen in  http://www.dynamicdrive.com/forums/
       username: jscheuer1 - This Notice Must Remain for Legal Use */
    
    if (document.images){
     (function(){
      var cos, times = 40, speed = 20, etype = null; 
      var expConIm = function(im){
       im = im || window.event;
       etype = im.type || null;
       if (!expConIm.r.test (im.className))
        im = im.target || im.srcElement || null;
       if (expConIm.cr.test (im.className) && etype == 'mouseover'){
        im.getElementsByTagName('img')[0].style.visibility = 'visible';
        return;
       }
       else if (!im || !expConIm.r.test (im.className))
        return;
       var e = expConIm,
       widthHeight = function(dim){
        return dim[0] * cos + dim[1] + 'px';
       },
       resize = function(){
        cos = (1 - Math.cos((e.ims[i].jump / times) * Math.PI)) / 2;
        im.style.width = widthHeight (e.ims[i].w);
        im.style.height = widthHeight (e.ims[i].h);
        if(/\bexcent\b/.test(im.className))
         im.style.left = '-' + parseInt(widthHeight (e.ims[i].w)) / 2 + 'px';
        if (e.ims[i].d && times > e.ims[i].jump){
         ++e.ims[i].jump;
         im.parentNode.style.zIndex = 3;
         e.ims[i].timer = setTimeout(resize, speed);
        } else if (!e.ims[i].d && e.ims[i].jump > 0){
         --e.ims[i].jump;
         im.parentNode.style.zIndex = 2;
         e.ims[i].timer = setTimeout(resize, speed);
        } else if (!e.ims[i].d && e.ims[i].jump < 1){
         im.parentNode.style.zIndex = '';
         im.style.visibility = 'hidden';
        }
       }, d = document.images, i = d.length - 1;
       for (i; i > -1; --i)
        if(d[i] == im) break;
       i = i + im.src;
       if (!e.ims[i]){
        im.title = '';
        e.ims[i] = {im : new Image(), jump : 0};
        e.ims[i].im.onload = function(){
         e.ims[i].w = [e.ims[i].im.width - im.width, im.width];
         e.ims[i].h = [e.ims[i].im.height - im.height, im.height];
         e (im);
        };
        e.ims[i].im.src = im.src;
        return;
        }
       if (e.ims[i].timer) clearTimeout(e.ims[i].timer);
       e.ims[i].d = !e.ims[i].d;
       if(e.ims[i].w && e.ims[i].h)
       resize ();
      };
    
      document.write('<style type="text/css">.start { background-position: -1000px!important;}.expando {visibility: visible;}<\/style>');
      
      expConIm.ims = {};
    
      expConIm.r = new RegExp('\\bexpando\\b');
      expConIm.cr = new RegExp('\\bexcontainer\\b');
    
      if (document.addEventListener){
       document.addEventListener('mouseover', expConIm, false);
       document.addEventListener('mouseout', expConIm, false);
      }
      else if (document.attachEvent){
       document.attachEvent('onmouseover', expConIm);
       document.attachEvent('onmouseout', expConIm);
      }
     })();
    }
    Last edited by jscheuer1; 01-29-2009 at 02:01 PM. Reason: minor style and script changes for non-javascript users
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  2. #22
    Join Date
    Jul 2007
    Location
    Spokane
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi John, Thanks for your desire to get this working.

    PS. the cartoons are not mine. I'm just the web designer.

  3. #23
    Join Date
    Jul 2007
    Location
    Spokane
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    That worked great John! In Win XP6 and FF3.

    Thanks Much!

    Lorel

  4. #24
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    27,637
    Thanks
    42
    Thanked 2,896 Times in 2,868 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by Lorel View Post
    Hi John, Thanks for your desire to get this working.

    PS. the cartoons are not mine. I'm just the web designer.
    Oh well, I know how that goes, tell Leigh then. I think it was in part my being impressed with his work that made me go the extra mile here, though I've often been known to do so at the drop of a hat.

    Quote Originally Posted by Lorel View Post
    That worked great John! In Win XP6 and FF3.

    Thanks Much!

    Lorel
    You're welcome. I tested it in a number of browsers, including those two, I don't anticipate any problems, but one never knows. If something comes up, we could try reverting to the earlier version for that browser, though any browser that has a problem with this one would probably have a problem with the older version (I'm thinking legacy browsers here - like older versions of Safari, or IE before v5.5, etc).
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #25
    Join Date
    Jul 2007
    Location
    Spokane
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi John,

    I'll relay all your hard work to Leigh re getting this working as I realize this was a special effor on your part.

    I'm not worried about anyone using a broswer before IE 5 as I never see those anymore. I'm using Safari 3x on the Mac and it looks perfect there--in fact Safari on the Mac doesn't cause a slight distortion when the images are increasing in size like on Windows broswers. But that may just be my Windows machine.

  6. #26
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    27,637
    Thanks
    42
    Thanked 2,896 Times in 2,868 Posts
    Blog Entries
    12

    Default

    I see it in IE 6 and Firefox 3 on Windows XP here, and a friend saw it on her Vista machine with Firefox 3. Using Safari 3 Win here, there was no problem, same thing with Opera 9.63. Some browsers are just better at interpolating images when asked to resize them. In the old days, none were any good at it. In a few years, all current version browsers will likely be adept.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #27
    Join Date
    Jul 2007
    Location
    Spokane
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi John,

    Just wanted to say that I moved the Rubes Cartoons site that is using the expando script to it's own domain:
    http://www.rubescartoons.com

    However now I have a minor problem.

    When I validated the code it wouldn't validate unless I made a few minor changes.

    This hover code in css file (no-repeat 0 0; ) wouldn't validate and the (0 0 caused a problem so I changed it to (background-repeat: no-repeat and left the (00) out.

    However now the images have a black background when they are loading in the Safari browser on Mac (doesn't show up in Windows Vista or Win XP IE 6) so I messed something up.

    Do you know what might be causing the black background when the page loads? I checked and don't see a background in CSS listed as black.

  8. #28
    Join Date
    May 2009
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi John,
    please help me on this... i tried many times but can't get this expando works.. i intergrated the crawler script and it's working fine but just this one is not working.. please help.

    PHP Code:
    <?php
    if ((!defined('NV_SYSTEM')) AND (!defined('NV_ADMIN'))) {
        
    Header("Location: ../index.php");
        exit;
    }
    $content  .= "<head>\n";
    $content  .= "<style type=\"text/css\">\n";
    $content  .= "img.expando{ /*sample CSS for expando images. Not required but recommended*/\n";
    $content  .= "border: none;\n";
    $content  .= "vertical-align: top; /*top aligns image, so mouse has less of a change of moving out of image while image is expanding*/\n";
    $content  .= "position: absolute;\n";
    $content  .= "top: 1;\n";
    $content  .= "left: 0;\n";
    $content  .= "}\n";
    $content  .= "</style>\n";
    $content  .= "</head>\n";
    $content  .= "<script type=\"text/javascript\" src=\"../js/expando.js\">\n";
    /* Expando Image Script ©2008 John Davenport Scheuer
       as first seen in [url]http://www.dynamicdrive.com/forums/[/url]
       username: jscheuer1 - This Notice Must Remain for Legal Use
    */
    $content  .= "</script>\n";
    $content  .= "<script type=\"text/javascript\" src=\"../js/crawler.js\"></script>\n";
    $content  .= "<div class=\"marquee\" id=\"mycrawler2\">\n";
    $content  .= "<p><p style=\"position:relative;\"><p align=\"center\">&nbsp;&nbsp;&nbsp;&nbsp;<SCRIPT language=\"JavaScript\" class=\"expando\" src=\"http://chuahuongdao.org/hinhanh/random.php?1\" width=\"140\" height=\"110\"></SCRIPT>\n";
    $content  .= "&nbsp;<SCRIPT language=\"JavaScript\" class=\"expando\" src=\"http://chuahuongdao.org/hinhanh/random.php?2\" width=\"140\" height=\"110\"></SCRIPT>\n";
    $content  .= "&nbsp;<SCRIPT language=\"JavaScript\" class=\"expando\" src=\"http://chuahuongdao.org/hinhanh/random.php?3\" width=\"140\" height=\"110\"></SCRIPT>\n";
    $content  .= "&nbsp;<SCRIPT language=\"JavaScript\" class=\"expando\" src=\"http://chuahuongdao.org/hinhanh/random.php?4\" width=\"140\" height=\"110\"></SCRIPT>\n";
    $content  .= "&nbsp;<SCRIPT language=\"JavaScript\" class=\"expando\" src=\"http://chuahuongdao.org/hinhanh/random.php?5\" width=\"140\" height=\"110\"></SCRIPT>\n";
    $content  .= "&nbsp;<SCRIPT language=\"JavaScript\" class=\"expando\" src=\"http://chuahuongdao.org/hinhanh/random.php?6\" width=\"140\" height=\"110\"></SCRIPT>\n";
    $content  .= "&nbsp;<SCRIPT language=\"JavaScript\" class=\"expando\" src=\"http://chuahuongdao.org/hinhanh/random.php?7\" width=\"140\" height=\"110\"></SCRIPT>\n";
    $content  .= "</div></p>\n";
    $content  .= "<script type=\"text/javascript\">\n";
    $content  .= "marqueeInit({\n";
    $content  .= "    uniqueid: 'mycrawler2',\n";
    $content  .= "    style: {\n";
    $content  .= "        'padding': '2px',\n";
    $content  .= "        'width': '600px',\n";
    $content  .= "        'height': '180px'\n";
    $content  .= "    },\n";
    $content  .= "    inc: 3, //speed - pixel increment for each iteration of this marquee's movement\n";
    $content  .= "    mouse: 'cursor driven', //mouseover behavior ('pause' 'cursor driven' or false)\n";
    $content  .= "    moveatleast: 2,\n";
    $content  .= "    neutral: 150,\n";
    $content  .= "    savedirection: true\n";
    $content  .= "});\n";
    $content  .= "</script>\n";
    ?>

  9. #29
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    27,637
    Thanks
    42
    Thanked 2,896 Times in 2,868 Posts
    Blog Entries
    12

    Default

    Please Start a new thread for a new question.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  10. #30
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    27,637
    Thanks
    42
    Thanked 2,896 Times in 2,868 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by Lorel View Post
    Hi John,

    Just wanted to say that I moved the Rubes Cartoons site that is using the expando script to it's own domain:
    http://www.rubescartoons.com

    However now I have a minor problem.

    When I validated the code it wouldn't validate unless I made a few minor changes.

    This hover code in css file (no-repeat 0 0; ) wouldn't validate and the (0 0 caused a problem so I changed it to (background-repeat: no-repeat and left the (00) out.

    However now the images have a black background when they are loading in the Safari browser on Mac (doesn't show up in Windows Vista or Win XP IE 6) so I messed something up.

    Do you know what might be causing the black background when the page loads? I checked and don't see a background in CSS listed as black.
    Not sure if we or you by yourself resolved this or not. However, I was going over old posts and found this issue. It is a minor one. The background style may be set as a composite, with repeat and positioning included as well as color and/or image, etc., ex:

    Code:
    background: yellow 0 0 no-repeat;
    But if you are just setting the repeat, ex:

    Code:
    background-repeat: no-repeat;
    You cannot include any other information. If you do, it will not validate and will be ignored by most browsers. Other browsers may execute whatever part of the directive seems valid to its error correcting algorithm.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •