• 0
Sign in to follow this  
Guest Hadouken

Janela Que Anda Na Tela

Question

Guest Hadouken

Gostaria de saber como fazer uma daquelas janelas que acompanham o scrolling, você vai lendo a página e a janelnha te acompanha...

Valeu !!

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0
<html>
<body>
<head>


<font size=5 color=black><b>ROLE A PÁGINA PARA TESTAR O EFEITO</font>


<style type="text/css">
#floater {
        position: absolute;
        left: 50%;
        top: 0;
        visibility: visible;
        z-index: 10;
}
</style>
<style fprolloverstyle>A:hover {color: #ffffff}
</style>
<STYLE>A:link {
    COLOR: #000000; TEXT-DECORATION: none
}
A:visited {
    COLOR: #ffffff; TEXT-DECORATION: none
}
A:hover {
    COLOR: red; TEXT-DECORATION: underline
}
</STYLE>
</head>



<script language="JavaScript1.2">
<!--
var dragswitch=0
var nsx
var nsy
var nstemp

function drag_dropns(name){
temp=eval(name)
temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)
temp.onmousedown=gons
temp.onmousemove=dragns
temp.onmouseup=stopns
}

function gons(e){
temp.captureEvents(Event.MOUSEMOVE)
nsx=e.x
nsy=e.y
}
function dragns(e){
if (dragswitch==1){
temp.moveBy(e.x-nsx,e.y-nsy)
return false
}
}

function stopns(){
temp.releaseEvents(Event.MOUSEMOVE)
}




var dragapproved=false

function drag_dropie(){
if (dragapproved==true){
document.all.floater.style.pixelLeft=tempx+event.clientX-iex
document.all.floater.style.pixelTop=tempy+event.clientY-iey
return false
}
}

function initializedragie(){
iex=event.clientX
iey=event.clientY
tempx=floater.style.pixelLeft
tempy=floater.style.pixelTop
dragapproved=true
document.onmousemove=drag_dropie
}


if (document.all){
document.onmouseup=new Function("dragapproved=false")
}


function hidebox(){
if (document.all)
floater.style.visibility="hidden"
else if (document.layers)
document.floater.visibility="hide"
}

//-->
</script>


 <script language="JavaScript">
<!--

        
        self.onError=null;
        
        currentX = currentY = 0;  
        whichIt = null;           
        lastScrollX = 0; lastScrollY = -130;
        
        NS = (document.layers) ? 1 : 0;
        IE = (document.all) ? 1: 0;
        

        function heartBeat() {
        
                if(IE) { diffY = document.body.scrollTop; diffX = document.body.scrollLeft; }
            if(NS) { diffY = self.pageYOffset; diffX = self.pageXOffset; }
                
                if(diffY != lastScrollY) {
                        percent = .1 * (diffY - lastScrollY);
                        if(percent > 0) percent = Math.ceil(percent);
                        else percent = Math.floor(percent);
                                        if(IE) document.all.floater.style.pixelTop += percent;
                                        if(NS) document.floater.top += percent; 
                        lastScrollY = lastScrollY + percent;
            }
                if(diffX != lastScrollX) {
                        percent = .1 * (diffX - lastScrollX);
                        if(percent > 0) percent = Math.ceil(percent);
                        else percent = Math.floor(percent);
                        if(IE) document.all.floater.style.pixelLeft += percent;
                        if(NS) document.floater.left += percent;
                        lastScrollX = lastScrollX + percent;
                }       
        }

        function checkFocus(x,y) { 
                stalkerx = document.floater.pageX;
                stalkery = document.floater.pageY;
                stalkerwidth = document.floater.clip.width;
                stalkerheight = document.floater.clip.height;
                if( (x > stalkerx && x < (stalkerx+stalkerwidth)) && (y > stalkery && y < (stalkery+stalkerheight))) return true;
                else return false;
        }
        
        function grabIt(e) {
                if(IE) {
                        whichIt = event.srcElement;
                        while (whichIt.id.indexOf("floater") == -1) {
                                whichIt = whichIt.parentElement;
                                if (whichIt == null) { return true; }
                    }
                        whichIt.style.pixelLeft = whichIt.offsetLeft;
                    whichIt.style.pixelTop = whichIt.offsetTop;
                        currentX = (event.clientX + document.body.scrollLeft);
                        currentY = (event.clientY + document.body.scrollTop);   
                } else { 
                window.captureEvents(Event.MOUSEMOVE);
                if(checkFocus (e.pageX,e.pageY)) { 
                        whichIt = document.floater;
                        StalkerTouchedX = e.pageX-document.floater.pageX;

                        StalkerTouchedY = e.pageY-document.floater.pageY;
                } 
                }
            return true;
        }
        
        function moveIt(e) {
                if (whichIt == null) { return false; }
                if(IE) {
                    newX = (event.clientX + document.body.scrollLeft);
                    newY = (event.clientY + document.body.scrollTop);
                    distanceX = (newX - currentX);    distanceY = (newY - currentY);
                    currentX = newX;    currentY = newY;
                    whichIt.style.pixelLeft += distanceX;
                    whichIt.style.pixelTop += distanceY;
                        if(whichIt.style.pixelTop < document.body.scrollTop) whichIt.style.pixelTop = document.body.scrollTop;
                        if(whichIt.style.pixelLeft < document.body.scrollLeft) whichIt.style.pixelLeft = document.body.scrollLeft;
                        if(whichIt.style.pixelLeft > document.body.offsetWidth - document.body.scrollLeft - whichIt.style.pixelWidth - 20) whichIt.style.pixelLeft = document.body.offsetWidth - whichIt.style.pixelWidth - 20;
                        if(whichIt.style.pixelTop > document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5) whichIt.style.pixelTop = document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5;
                        event.returnValue = false;
                } else { 
                        whichIt.moveTo(e.pageX-StalkerTouchedX,e.pageY-StalkerTouchedY);
                if(whichIt.left < 0+self.pageXOffset) whichIt.left = 0+self.pageXOffset;
                if(whichIt.top < 0+self.pageYOffset) whichIt.top = 0+self.pageYOffset;
                if( (whichIt.left + whichIt.clip.width) >= (window.innerWidth+self.pageXOffset-17)) whichIt.left = ((window.innerWidth+self.pageXOffset)-whichIt.clip.width)-17;
                if( (whichIt.top + whichIt.clip.height) >= (window.innerHeight+self.pageYOffset-17)) whichIt.top = ((window.innerHeight+self.pageYOffset)-whichIt.clip.height)-17;
                return false;
                }
            return false;
        }
        
        function dropIt() {
                whichIt = null;
            if(NS) window.releaseEvents (Event.MOUSEMOVE);
            return true;
        }
        
        if(NS) {
                window.captureEvents(Event.MOUSEUP|Event.MOUSEDOWN);
                window.onmousemove = moveIt;
                window.onmouseup = dropIt;
        }
        if(IE) {
                document.onmousemove = moveIt;
                document.onmouseup = dropIt;
        }
        
        if(NS || IE) action = window.setInterval("heartBeat()",1);
             


//-->
</script>

<div id="floater" align="center">

<a href="paginadois.html"><img src="figura2.gif"
  tppabs="" border="0"
   align="center" usemap="#FPMap0" alt="ESSE LINK TE LEVA A PÁGINA PRINCIPAL DO SITE"><font size=2 color=black>Você escolhe entre a figura ou um texto como link</font></a></dd>
</div>
</body>


<!---------------APAGUE ESSA ABAIXO------------------>
<P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR><P><BR>
<!----------------------APAGUE ESSA ACIMA----------------------------->

</BODY>
</HTML>


 

Share this post


Link to post
Share on other sites
  • 0

este funciona no FF e no IE

<script>
if (!document.layers)
document.write('<div id="divStayTopLeft" style="position:absolute">')
</script>

<layer id="divStayTopLeft">

<!--EDIT BELOW CODE TO YOUR OWN MENU-->
<table border="0" width="150" cellspacing="0" cellpadding="0">
  <tr>
    <td width="100%" bgcolor="#FFFFFF">
      <p align="left">
       <a href="http://www.simpleplanst.com.br/">Link 1</a></td>
       <a href="http://www.steffan2005.oi.com.br/" target="_blank">Link 3</a></td>
       <a href="http://www.google.com.br/"><img alt="Link 2 (pode ser imagem)" src="link3.gif" width="150" height="100" border="0"></a></td>
  </tr>
</table>
<!--END OF EDIT-->

</layer>

<script type="text/javascript">

/*
Floating Menu script-  Roy Whittle (http://www.javascript-fx.com/)
Script featured on/available at http://www.dynamicdrive.com/
This notice must stay intact for use
*/

//Enter "frombottom" or "fromtop"
var verticalpos="frombottom"

if (!document.layers)
document.write('</div>')

function JSFX_FloatTopDiv()
{
var startX = 820,
startY = 150;
var ns = (navigator.appName.indexOf("Netscape") != -1);
var d = document;
function ml(id)
{
  var el=d.getElementById?d.getElementById(id):D.all?d.all[id]:D.layers[id];
  if(d.layers)el.style=el;
  el.sP=function(x,y){this.style.left=x;this.style.top=y;};
  el.x = startX;
  if (verticalpos=="fromtop")
  el.y = startY;
  else{
  el.y = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
  el.y -= startY;
  }
  return el;
}
window.stayTopLeft=function()
{
  if (verticalpos=="fromtop"){
  var pY = ns ? pageYOffset : document.body.scrollTop;
  ftlObj.y += (pY + startY - ftlObj.y)/8;
  }
  else{
  var pY = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
  ftlObj.y += (pY - startY - ftlObj.y)/8;
  }
  ftlObj.sP(ftlObj.x, ftlObj.y);
  setTimeout("stayTopLeft()", 10);
}
ftlObj = ml("divStayTopLeft");
stayTopLeft();
}
JSFX_FloatTopDiv();
</script>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</body>
</html>

PRA MUDAR A POSICAO INICIAL:

var startX = 820,

startY = 150;

e so mudar esses valores que tão no meio do codigo

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this