04. februar 2009 - 19:51
Der er
5 kommentarer og 1 løsning
tjek om scoll er på side eller ikke
Hey Manger et script som kan oplys min side om der er scroll bar på eller ik... er der en måde hvor på man kan tjekke dette?
Annonceindlæg tema
Forsvar & beredskab
Cybersikkerhed, realtidsdata og robuste it-systemer er blevet fundamentet for moderne forsvar.
04. februar 2009 - 20:07
#1
Du kan sammenligne højden af body med størrelsen af browseren.
04. februar 2009 - 20:10
#2
okay nu er jeg ikke den store javascript nørd.. hvordan gøre jeg lige det?
04. februar 2009 - 20:15
#3
Har prøvet dette af men det virker ikke... den skrive samme højde lige meget hvad <!-- var viewportwidth; var viewportheight; // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight if (typeof window.innerWidth != 'undefined') { viewportwidth = window.innerWidth, viewportheight = window.innerHeight } // IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document) else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) { viewportwidth = document.documentElement.clientWidth, viewportheight = document.documentElement.clientHeight } // older versions of IE else { viewportwidth = document.getElementsByTagName('body')[0].clientWidth, viewportheight = document.getElementsByTagName('body')[0].clientHeight } alert('<p>Your viewport width is '+viewportwidth+'x'+viewportheight+'</p>'); //--> <!-- Hide from non-JS browsers var scnWid,scnHei; if (self.innerHeight) // all except Explorer { scnWid = self.innerWidth; scnHei = self.innerHeight; } else if (document.documentElement && document.documentElement.clientHeight) // Explorer 6 Strict Mode { scnWid = document.documentElement.clientWidth; scnHei = document.documentElement.clientHeight; } else if (document.body) // other Explorers { scnWid = document.body.clientWidth; scnHei = document.body.clientHeight; } alert('<p>Your inner width is '+scnWid+'x'+scnHei+'</p>'); // -->
04. februar 2009 - 22:38
#4
<ole> <script type="text/javascript"> window.onload = function(){ var viewportwidth; var viewportheight; // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight if (typeof window.innerWidth != 'undefined') { viewportwidth = window.innerWidth, viewportheight = window.innerHeight } // IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document) else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) { viewportwidth = document.documentElement.clientWidth, viewportheight = document.documentElement.clientHeight } // older versions of IE else { viewportwidth = document.getElementsByTagName('body')[0].clientWidth, viewportheight = document.getElementsByTagName('body')[0].clientHeight } alert('Your viewport is '+viewportwidth+'x'+viewportheight+' pixels'); var sBodyWidth = document.body.offsetWidth; var sBodyHeight = document.body.offsetHeight; alert('Your body element is '+sBodyWidth+'x'+sBodyHeight+' pixels'); } </script> /mvh </bole>
06. februar 2009 - 16:21
#5
okay det virkede smid et svar
06. februar 2009 - 17:52
#6
*griiiiiiiiiiiiiiiiiiiiiib* =)
Vi tilbyder markedets bedste kurser inden for webudvikling