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

Mudando Valor Do Body


fsilvarib

Pergunta

Olá pessoal tudo bem?

Sou novo por aqui e preciso de uma ajudinha.....

Eu acho que não é tão facil assim mas lá vai.

Existe a possibilidade de fazer em Java Script um esquema que detecte a resolução de quem ta navegando e aí dependo da resolução ele muda o valor margin-top do BODY.

Pois não estou conseguindo centralizar meu site por completo, eu só consegui centralizar ele nas laterais.

alguém poderia me da uma ajudinha por favor?

Muito obrigado a todos que leram minha dúvido.

Até mais.

Link para o comentário
Compartilhar em outros sites

6 respostass a esta questão

Posts Recomendados

  • 0

Existe a possibilidade de fazer em Java Script um esquema que detecte a resolução de quem ta navegando

screen.height //Captura a resolução vertical de pixel
screen.width //Captura a resolução horizontal de pixel

//Exemplo: alert(screen.width + " x " + screen.height)
//Aqui em casa, o exemplo retornaria '1024 X 768'.
e aí dependo da resolução ele muda o valor margin-top do BODY
Humm.. Que tal redirecionamento:
if(screen.height == 768 && screen.width == 1024)
{
document.location="ENDERECO";
}
else
{
document.location="ENDERECO";
}

Qualquer dúvida, post! Falows!

Link para o comentário
Compartilhar em outros sites

  • 0

Coloca isso aqui:

<table align="center">

Ou então isso aqui:

<script>

var site="http://www.SEU*SITE.com/"

/* VALORES = liga ou desliga */

var alerta="desliga"

if (screen.width==1280 && screen.height==1024)

{this.location=site + '1280x1024.html'}

if (screen.width==1280 && screen.height==960)

{this.location=site + '1280x960.html'}

if (screen.width==1280 && screen.height==768)

{this.location=site + '1280x768.html'}

if (screen.width==1280 && screen.height==720)

{this.location=site + '1280x720.html'}

if (screen.width==1152 && screen.height==864)

{this.location=site + '1152x864.html'}

if (screen.width==1024 && screen.height==768)

{top.location=site + '1024x768.html'}

if (screen.width==848 && screen.height==480)

{this.location=site + '848x480.html'}

if (screen.width==800 && screen.height==600)

{this.location=site + '800x600.html'}

if (screen.width==640 && screen.height==480)

{this.location=site + '640x480.html'}

if (alerta=='liga'){

alert ('Suas configurações de vídeo foram detectadas com êxito: '+screen.width+'×'+screen.height+' pixels\n\nRedirecionando ...')}

else {}

</script>

Link para o comentário
Compartilhar em outros sites

  • 0

if (screen.width==1280 && screen.height==1024)

{var arquivo = '1280x1024.css'}

if (screen.width==1280 && screen.height==960)

{var arquivo = '1280x960.css'}

if (screen.width==1280 && screen.height==768)

{var arquivo = '1280x768.css'}

if (screen.width==1280 && screen.height==720)

{var arquivo = '1280x720.css'}

if (screen.width==1152 && screen.height==864)

{var arquivo = '1152x864.css'}

if (screen.width==1024 && screen.height==768)

{var arquivo = '1024x768.css'}

if (screen.width==848 && screen.height==480)

{var arquivo = '848x480.css'}

if (screen.width==800 && screen.height==600)

{var arquivo = '800x600.css'}

if (screen.width==640 && screen.height==480)

{var arquivo = '640x480.css'}

document.write ('<link href="' + arquivo + '" rel="stylesheet" type="text/css"/>');

acho que assim funciona do jeito que você precisa!

abraços

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.


  • Estatísticas dos Fóruns

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