Results 1 to 1 of 1

Thread: prehistoric version of dynamic_drive.js

  1. #1
    Join Date
    Mar 2021
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default prehistoric version of dynamic_drive.js

    hello -

    i am using probably a prehistoric version of dynamic_drive.js.

    today i had to make the following changes:

    line 37:
    OLD: + ( (typeof x_position!="undefined" && x_position.indexOf("right")!=-1)
    NEW: + ( (typeof x_position!="undefined" && x_position.toString().indexOf("right")!=-1)

    line 53:
    OLD: + ( (typeof y_position!="undefined" && y_position.indexOf("bottom")!=-1
    NEW: + ( (typeof y_position!="undefined" && y_position.toString().indexOf("bottom")!=-1

    i believe a new version of google-chrome "broke" the code.

    or should i be using a much newer version of dynamic_drive.js? maybe this version was written by your grandfather?

    Code:
    /***********************************************
    * Drop Down/ Overlapping Content- ▒ Dynamic Drive (www.dynamicdrive.com)
    * This notice must stay intact for legal use.
    * Visit http://www.dynamicdrive.com/ for full source code
    *
    *       2021-03-28      -- channged _position.indexOf( to _position.toString().indexOf(
    ***********************************************/
    
    function getposOffset(overlay, offsettype){
            var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
            var parentEl=overlay.offsetParent;
            while (parentEl!=null){
                    totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
                    parentEl=parentEl.offsetParent;
            }
            return totaloffset;
    }
    
    var globalCurobjOffsetWidth     =       0       ;       // save values in case
    var globalCurobjOffsetHeight    =       0       ;       // the popup form comes thru without an offsetWidth/offsetHeight
    
    function overlay(curobj, subobjstr, x_position, y_position, x_offset, y_offset ){
      if (document.getElementById){
        var subobj=document.getElementById(subobjstr)
        subobj.style.display=(subobj.style.display!="block")? "block" : "none"
    
        var xpos='';
        var ypos='';
    
        if  ( curobj.offsetWidth > 0 )      {               // for some reason, offsetWidth is coming thru as zero
                                                            // on the popup form
    
                if  ( x_position == parseInt(x_position)    )       {
                    xpos=x_position;
                } else {
                   xpos=getposOffset(curobj, "left")
                            +       (       (typeof x_position!="undefined" && x_position.toString().indexOf("right")!=-1)
                                    ?       -(subobj.offsetWidth-curobj.offsetWidth)
                                    :       0
                                    )
                                    ;
                };
            globalCurobjOffsetWidth =       xpos    ;
        } else {
            xpos = globalCurobjOffsetWidth + 20     ;
        };
    
        if  ( curobj.offsetHeight > 0 )     {               // again, for some reason, offsetHeight comes thru as zero
                if  ( y_position == parseInt(y_position)    )       {
                    ypos=y_position;
                } else {
                    ypos=getposOffset(curobj, "top")
                            +       (       (typeof y_position!="undefined" && y_position.toString().indexOf("bottom")!=-1)
                                    ?       curobj.offsetHeight
                                    :       0
                                    )
                                    ;
                };
            globalCurobjOffsetHeight        =       ypos    ;
        } else {
            ypos = globalCurobjOffsetHeight + 20 ;
        };
    
        if  ( x_offset == parseInt(x_offset)        )       {
            xpos += parseInt(x_offset);                             // 2007-06-07 - added parseInt (not tested before?)
        };
        if  ( y_offset == parseInt(y_offset)        )       {
            ypos += parseInt(y_offset);                             // 2007-06-07 - added parseInt[
        };
    
        //alert ( xpos + '<-->' + ypos );
        subobj.style.left=xpos+"px"
        subobj.style.top=ypos+"px"
        return false;
      } else {
        return true;
      };
    }
    
    function overlayclose(subobj){
            document.getElementById(subobj).style.display="none"
    }
    Last edited by james438; 03-30-2021 at 01:39 AM. Reason: format

Similar Threads

  1. Prehistoric religion?
    By molendijk in forum The lounge
    Replies: 11
    Last Post: 02-23-2013, 11:16 PM
  2. Version issues
    By borris83 in forum PHP
    Replies: 2
    Last Post: 04-02-2009, 03:51 PM
  3. Simple Version
    By rhdartayet in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 03-16-2009, 11:59 PM
  4. ScrollerDiv, version 1.1
    By Nile in forum JavaScript
    Replies: 3
    Last Post: 09-28-2008, 01:24 AM
  5. Replies: 8
    Last Post: 10-11-2007, 06:18 AM

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
  •