Results 1 to 3 of 3

Thread: Width Bug in Advanced Gallery script

  1. #1
    Join Date
    May 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Width Bug in Advanced Gallery script

    Hi,

    it took me 3 hours to figure out this bug... actually the Gecko-Engine returns only the visible part of a DIV-Layer when you try to get its offsetWidth.

    I spotted a workaround in the mozilla bugtracker, and used a function mentioned there to get around this bug... this works fine for me:

    Code:
    function getContentWidth(el){
         var tmp=el.style.overflow
         el.style.overflow='auto'
         var w=el.scrollWidth
         el.style.overflow=tmp
         return w
    }
    
    function fillup(){
    if (iedom){
    crossmain=document.getElementById ? document.getElementById("motioncontainer") : document.all.motioncontainer
    menuwidth=parseInt(crossmain.style.width)
    mainobjoffset=getposOffset(crossmain, "left")
    cross_scroll=document.getElementById? document.getElementById("motiongallery") : document.all.motiongallery
    document.getElementById("temp").innerHTML=cross_scroll.innerHTML //NEW stuff
    actualwidth=document.all? cross_scroll.offsetWidth : getContentWidth(document.getElementById("temp"))
    if (!window.opera) document.getElementById("temp").style.display="none"
    
    crossmain.onmousemove=function(e){
    motionengine(e)
    }
    
    crossmain.onmouseout=function(e){
    stopmotion(e)
    showhidediv("hidden")
    }
    }
    loadedyes=1
    if (endofgallerymsg!=""){
    creatediv()
    positiondiv()
    }
    }
    Greetz, Novalis
    www.exanto.de

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Script referred to: http://www.dynamicdrive.com/dynamicindex17/agallery.htm

    I see what you're doing in the above code, though can you describe the bug in more detail and in which browsers (ie: Mozilla, Firefox etc) it occurs in? Nice technique, though I don't see where Advanced Gallery script needs to get the actual content width of its subject.

  3. #3
    Join Date
    May 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi,

    the bug occurs in the current Gecko-Engine, so Mozilla is likely affected as well. I just tested in Firefox, and the bug occured there.

    The script needs to get the width of the content to start / stop / scroll the scrolling. So when you scroll to the right (with a lot of images in the scroller) it will stop at the actual screen size (ie 1280px on my screen), because Gecko returns the width of the visible part only. To rebuild the bug you need to have pictures / content with a width > your actual horizontal screen width.

    I hope this helps! My english isn't the best, so I'm missing some expressions to describe it better ;-)

    Greetz,
    Novalis

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
  •