Results 1 to 2 of 2

Thread: Chrome Drop down and safari issues

  1. #1
    Join Date
    Dec 2006
    Posts
    6
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Chrome Drop down and safari issues

    1) Script Title: Chrome Drop down menu 2.01

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...rome/index.htm

    3) Describe problem:

    Everything great on every thing I try on the pc (ff, ie6, konqueror). Unfortunately, the guy I've done the site for is on a mac (safari) and the drop down appears about 5mm below and to the left of the bar. I don't have a mac myself and have no idea what's wrong with it...the script that is - there's plenty of things wrong with a mac

    I've tried swift the safari emulator but that seems to be happy too.

    Anyone got any advice...please...

    http://www.themanthatcan.com/globalnet/home.htm

    Many thanks.

    Richard

    PS I'm fairly new to css so it's all a bit of a mess. The problem I had was when I decided to center everything so I then couldn't really use absolute values. I eventually found I could only get it to work reasonably if I put it all in a big single-celled centered table.

  2. #2
    Join Date
    Jul 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Patch for IE/Safari/Firefox

    I posted this on another thread, but it may apply here, as well:
    ---
    Hi, all. I patched the dropdown.js script to handle the case where one of the ancestor elements is relatively positioned. In this case, the absolute positioning of the menu is relative to that "containing block" and the offset calculation should end there.

    Here is the modified function (getposOffset), with an nested function to handle IE, Safari, and Firefox:

    Code:
    getposOffset:function(what, offsettype){
      function getStyle(el,styleProp) {
      	if (typeof el.currentStyle != "undefined") {
      		var y = el.currentStyle[styleProp];
      	} else if (typeof document.defaultView != "undefined" && typeof document.defaultView.getComputedStyle != "undefined") {
      		var y = document.defaultView.getComputedStyle(el,null).getPropertyValue(styleProp);
      	} else {
      		var y = el.style[styleProp];  	  
      	}
      	return y;
      }
      
      var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
      var parentEl=what.offsetParent;
      while (parentEl!=null && getStyle(parentEl, "position") != "relative"){
        totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
        parentEl=parentEl.offsetParent;
      }
      return totaloffset;
    },

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
  •