Results 1 to 3 of 3

Thread: dock content help

  1. #1
    Join Date
    Jun 2007
    Posts
    18
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default dock content help

    i found a script that i want to use on my site, but i cant seem to get it working in a scrolling div box....
    the content within the div is pulled from another page with an ajax code i found.
    so i need to use it within that page.

    here is the DockContent Script

    can someone help me with this

    thanks

    vinny
    Last edited by vinny.benson; 09-02-2009 at 06:55 PM.

  2. #2
    Join Date
    May 2008
    Posts
    144
    Thanks
    6
    Thanked 11 Times in 11 Posts

    Default

    lets see the code youre currently using

  3. #3
    Join Date
    Jun 2007
    Posts
    18
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default

    this is the code on the users page:
    Code:
    <style type="text/css">
    
    .dockclass{
    position:relative;
    }
    
    </style>
    
    
    <script type="text/javascript">
    
    /***********************************************
    * Dock Content script- Created by and © Dynamicdrive.com
    * This notice must stay intact for use
    * Visit http://www.dynamicdrive.com/ for full script
    ***********************************************/
    
    var offsetfromedge=0      //offset from window edge when content is "docked". Change if desired.
    var dockarray=new Array() //array to cache dockit instances
    var dkclear=new Array()   //array to cache corresponding clearinterval pointers
    
    function dockit(el, duration){
    this.source=document.all? document.all[el] : document.getElementById(el);
    this.source.height=this.source.offsetHeight;
    this.docheight=truebody().clientHeight;
    this.duration=duration;
    this.pagetop=0;
    this.elementoffset=this.getOffsetY();
    dockarray[dockarray.length]=this;
    var pointer=eval(dockarray.length-1);
    var dynexpress='dkclear['+pointer+']=setInterval("dockornot(dockarray['+pointer+'])",100);';
    dynexpress=(this.duration>0)? dynexpress+'setTimeout("clearInterval(dkclear['+pointer+']); dockarray['+pointer+'].source.style.top=0", duration*1000)' : dynexpress;
    eval(dynexpress);
    }
    
    dockit.prototype.getOffsetY=function(){
    var totaloffset=parseInt(this.source.offsetTop);
    var parentEl=this.source.offsetParent;
    while (parentEl!=null){
    totaloffset+=parentEl.offsetTop;
    parentEl=parentEl.offsetParent;
    }
    return totaloffset;
    }
    
    function dockornot(obj){
    obj.pagetop=truebody().scrollTop;
    if (obj.pagetop>obj.elementoffset) //detect upper offset
    obj.source.style.top=obj.pagetop-obj.elementoffset+offsetfromedge+"px";
    else if (obj.pagetop+obj.docheight<obj.elementoffset+parseInt(obj.source.height)) //lower offset
    obj.source.style.top=obj.pagetop+obj.docheight-obj.source.height-obj.elementoffset-offsetfromedge+"px";
    else
    obj.source.style.top=0;
    }
    
    function truebody(){
    return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
    }
    
    </script>
    
    
    
    <div id="A" class="dockclass">A</div>
    <div style="height:600px;"></div>
    
    <div id="B" class="dockclass">B</div>
    <div style="height:600px;"></div>
    
    <div id="C" class="dockclass">C</div>
    <div style="height:600px;"></div>
    
    <div id="D" class="dockclass">D</div>
    <div style="height:600px;"></div>
    
    
    
    
    <script type="text/javascript">
    
    var dock0=new dockit("A", 0);
    var dock1=new dockit("B", 0);
    var dock2=new dockit("C", 0);
    var dock3=new dockit("D", 0);
    
    </script>
    and this is the ajax code that pulls the page into the div

    Code:
    <script type="text/javascript">
    var xmlHttp5;
    
    function countMail(src)
    { 
    xmlHttp5=GetXmlHttp5Object();
    if (xmlHttp5==null)
      {
    sendRequest('ErrorMessage', 'Javascript Error.<br>AJAX not Supported!', 'blip.wav');
      return;
      } 
    var url="users.php";
    url=url+"?q="+src;
    xmlHttp5.onreadystatechange=stateChanged5;
    xmlHttp5.open("GET",url,true);
    xmlHttp5.send(null);
    }
    function stateChanged5() 
    { 
    if (xmlHttp5.readyState==4)
    { 
    document.getElementById("Users").innerHTML=xmlHttp5.responseText;
    }
    }
    function GetXmlHttp5Object()
    {
    var xmlHttp5=null;
    try
      {
      // Firefox, Opera 8.0+, Safari
      xmlHttp5=new XMLHttpRequest();
      }
    catch (e)
      {
      // Internet Explorer
      try
        {
        xmlHttp5=new ActiveXObject("Msxml2.XMLHTTP");
        }
      catch (e)
        {
        xmlHttp5=new ActiveXObject("Microsoft.XMLHTTP");
        }
      }
    setTimeout('Users("all")', 1000);
    return xmlHttp5;
    }
    </script>
    <div id="Users">
    </div>

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
  •