Guest User

Untitled

a guest
Dec 18th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function blackout(idIB,min,max) {
  2.     if (idIB<min) {idIB=max;}
  3.     if (idIB>max) {idIB=min;}
  4.     // xhr запрос
  5.     var url='program/loadingOf.php?imgB='+idIB;parseInt(idIB)+1;
  6.     xmlhttp.open("GET",url,true);
  7.     xmlhttp.send();
  8.     xmlhttp.onreadystatechange=function() {
  9.  
  10.     if (xmlhttp.readyState==4) {
  11.         if(xmlhttp.responseText) {
  12.             var resp = xmlhttp.responseText.replace('\r\n', '');
  13.             if (resp!='') {
  14.     var blackout = document.getElementById('blackout');
  15.     blackout.style.width= screen.availWidth+'px';
  16.     blackout.style.height=screen.availHeight+'px';
  17.     blackout.innerHTML = '<img id="imgB" onclick="blackout('+idIB+','+min+','+max+');"/>';
  18.     document.location.hash=n;
  19.     var imgB = document.getElementById('imgB');
  20.                 imgB.src='photo/'+resp;
  21.     imgB.style.zIndex='200';
  22.     imgB.style.position='fixed';
  23.     imgB.style.cursor='pointer';
  24.     imgB.style.maxHeight=getViewportHeight();
  25.     imgB.style.maxWidth=screen.availWidth-100;
  26.     imgB.style.left=screen.availWidth/2-imgB.width/2+'px';
  27.     imgB.style.top=getViewportHeight()/2-imgB.height/2+'px';
  28.     var close = document.getElementById('close');
  29.     close.style.left=parseInt(imgB.style.left)+imgB.width+'px';
  30.     close.style.width=screen.availWidth-parseInt(close.style.left)+'px';
  31.     close.style.height=getViewportHeight()+'px';
  32.             }
  33.         }
  34.     }
  35. }
  36. }
Add Comment
Please, Sign In to add comment