PROFESSIONAL NEWSGROUPS
WINDEV
,
WEBDEV
and
WINDEV Mobile
Home
|
Recent messages
|
Connect
|
Sign out
|
English
Home
→
WINDEV 25
→
WB - Detectar a área útil do navegador
WB - Detectar a área útil do navegador
Started by BOLLER, Jan., 16 2017 6:14 PM - No answer
Connect yourself…
BOLLER
#1
Registered member
3,662 messages
Popularité : +175 (223 votes)
Posted on January, 16 2017 - 6:14 PM
Prezados,
CODIGO QUE DETECTA A AREA UTIL DO NAVEGADOR
function detectBrowserSize
(
) {
var myWidth
=
0
,
myHeight
=
0
;
if
(
typeof
(
window.innerWidth
) =
=
'number'
) {
/
/
Non
-
IE
myWidth
=
window.innerWidth
;
myHeight
=
window.innerHeight
;
}
else if
(
document.documentElement
&
& (
document.documentElement.clientWidth
|
|
document.documentElement.clientHeight
)
) {
/
/
IE
6
+
in
'standards compliant mode'
myWidth
=
document.documentElement.clientWidth
;
myHeight
=
document.documentElement.clientHeight
;
}
else if
(
document.body
&
& (
document.body.clientWidth
|
|
document.body.clientHeight
)
) {
/
/
IE
4
compatible
myWidth
=
document.body.clientWidth
;
myHeight
=
document.body.clientHeight
;
}
alert
(
myWidth
+
' - '
+
myHeight
)
}
/
/
http
:
/
/
stackoverflow.com
/
questions
/
1587499
/
detecting
-
browser
-
client
-
area
-
size
-
on
-
wide
-
screen
-
using
-
javascript
Engraçado que no IE aqui, so consegui ler o Width... o Height so dava 0 (zero).
Consegui resolver utilizando isso:
document.body.clientWidth
document.body.clientHeight
Isso no caso de IE... Com outros browser o innerwidth e height funciona beleza.
No caso, eu tb precisei fazer um evento de drag e drop mas sem deixar dar overflow.
o trecho citado acima ficou assim:
function detectBrowserSize
(
) {
if
(
navigator.appName.indexOf
(
"Microsoft"
)
!
=
-
1
)
{
w
=
document.body.clientWidth
;
h
=
document.body.clientHeight
;
}
else
w
=
window.innerWidth
;
h
=
window.innerHeight
;
/
/
objW e objH relacionados abaixo é o width e height do objeto que sofrera o drag e drop
/
/
acrescentei
+
10
pra não ficar colado nas bordas finais
.
limitDragX
=
w
- (
objW
+
10
)
;
limitDragY
=
h
- (
objH
+
10
)
;
}
--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 9949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/
Report
0
0
→ Go back to WINDEV 25
WINDEV 25
Français
English
Español
Portuguesa
Close this window
Search type
Only topics
All the messages
Search period
Any time
Past hour
Past 24 hours
Past week
Past month
Past year
Cancel
Preview of your message
Adding an image
Import an image from a URL
Send an image from a file of your disk
Drop a file or click "Browse..."
or
Cancel
0%
WLanguage
SQL
XML, HTML
JAVA, Javascript
Text