Ir para conteúdo
Fórum Script Brasil
  • 0

Ralor Imagem


jlnegao

Pergunta

1 resposta a esta questão

Posts Recomendados

  • 0

Olá jlnegao,

Eu tenho um código aqui que pode lhe ajudar,

esse código detecta se a pessoa usa a resoluçao

do monitor maior que 800x600 e mostra ao lado

direito um iframe que desce junto com a barra

de rolagem..

um exemplo: www.nada-night.com.br

o código é esse:

<script>
<!----
        self.onError=null;
        currentX = currentY = 0;  
        whichIt = null;           
        lastScrollX = 0; lastScrollY = 1;
        NS = (document.layers) ? 1 : 0;
        IE = (document.all) ? 1: 0;
        function heartBeat() {
  if(screen.width <= 800)
  	{
    return false;
  	}	
            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 dropIt() {
                whichIt = null;
            if(NS) window.releaseEvents (Event.MOUSEMOVE);
            return true;
        }
        
        if(NS) {
                window.captureEvents(Event.MOUSEUP|Event.MOUSEDOWN);
                window.onmousedown = grabIt;
                window.onmouseup = dropIt;
        }
        if(IE) {
                document.onmousedown = grabIt;
                document.onmouseup = dropIt;
        }
        
        if(NS || IE) action = window.setInterval("heartBeat()",1);

// Verificar se a resolução vídeo for > 800 X 600
if(screen.width > 800)
	{
  document.write ('<div id=floater style="position:absolute; left:775px; top:5px">')
  document.write ('<iframe name="framelateral" src="http://www.seusite.com.br/pagina.html" width=largura height=altura scrolling=no frameborder=0></iframe>')
  document.write ('</div>');
	}
//---->
</SCRIPT>

Qualquer duvida fala ae..

vlw..

Link para o comentário
Compartilhar em outros sites

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,2k
    • Posts
      651,9k
×
×
  • Criar Novo...