Through the efforts of the participants of the site, I understood a little where to dig in the editing of the code. In general rewrote under jQuery. But the code does not work ... What did I do wrong? Tell me.

Problem solved in a completely different way. Thanks to all.

function hide_div() { //var rnd_200 = Math.round(Math.random()*4) + 7; swap_img('loader_' + rnd_200); clearTimeout(show_delay); show_delay = null; if (!obj_float_div) return; obj_float_div.style.visibility = 'hidden'; obj_float_div.style.left = "-3000px"; obj_float_div = false; } var IE = (document.all); var NC = (document.layers); var Opera = (document.getElementById); function getWidth() { if (IE) return document.body.clientWidth; if (NC) return window.innerWidth; if (Opera) return document.body.offsetWidth; return 1024; } var cmw; var hfw; var ww; function recount() { var ttt; if (window.getSize().x >= 1690) { ttt = 8; } else if (window.getSize().x >= 1260) { ttt = 6; } else { ttt = 4; } cmw = ttt * 205; hfw = cmw - 5; ww = hfw + 30; } window.onload = resizecontent; window.onresize = resizecontent; function resizecontent() { recount(); $('#header').css({ 'width': hfw + 'px' }); $('#footer').css({ 'width': hfw + 'px' }); if ($('#contentmain').length > 0) { $('#contentmain').css({ 'width': cmv + 'px' }); } else { $('#wrapper').css({ 'width': ww }); } if ($('#imagezoom_overlay').length > 0) { $('#imagezoom_overlay').width(document.body.clientWidth); $('#imagezoom_overlay').height(window.innerHeight().y); } } 

text in italics

  • What should this code do? - Dem
  • It resizes the page depending on the screen resolution. - Dani
  • one
    As far as I remember, you already solved this problem yesterday .... - LeD4eG

1 answer 1

It resizes the page depending on the screen resolution.

From this it was necessary to begin.

 var w = $(window); w.resize(function(){ $('body').css({ width: w.width() + 'px', height: w.height() + 'px' }); }).resize(); 

And if you need to stretch the entire width of the screen, not the window, use the standard screen object.

  • Hm Those. Am I removing my code completely and inserting only this one? I just have pictures on my site in a row. The size of the pictures is 200x200. The code that I posted here for the first time: hashcode.ru/questions/78288/ redo- code-sub- jQuery worked for mootools, but it didn't work on jquery. - Dani
  • Because The pictures on the site are 200 by 200, in this code, as I understand it, there are ttt values. If the resolution is x> = 1690, then cmw = ttt * 205; etc. Generally confused ... - Dani
  • Therefore, I need to redo the code that I posted .. But it does not work. What values ​​can I have tried. - Dani
  • var cmw; var hfw; var ww; function recount () {var ttt; if (window.getSize (). x> = 1690) {ttt = 8; } else if (window.getSize (). x> = 1260) {ttt = 6; } else {ttt = 4; } cmw = ttt * 205; hfw = cmw - 5; ww = hfw + 30; } Correcting for: - Dani
  • one