Здравейте хора,
Сори че отварям отделна тема, но немога да се сегя как да задам постоянна широчина на снимките в този скрипт (примерно 200px):
http://web-tourist.net/login/login/view.php?st=2721
Урока е от вашия сайт.
Благодаря предварително.
EDIT: Оправих се ... може да локнете темата!
Сори че отварям отделна тема, но немога да се сегя как да задам постоянна широчина на снимките в този скрипт (примерно 200px):
http://web-tourist.net/login/login/view.php?st=2721
Код:
<?php
include("config.php");
?>
<html>
<head>
<title>Галерията на <?php echo $title; ?></title>
<meta http-equiv="content-type" content="text/html; charset=windows-1251" />
<link rel="stylesheet" href="style/<?php echo $style; ?>.css" />
<script type="text/javascript">
var links=new Array();
var width=new Array();
var height=new Array();
<?php
include("config.php");
$dir=opendir("$directory");
$i=0;
while($file=readdir($dir)) {
$ext=strtolower(end(explode(".",$file)));
if($ext=="png" || $ext=="gif" || $ext=="jpeg" || $ext=="jpg") {
list($width,$height,$type,$attr)=getimagesize("$directory$file");
echo "links[$i]=\"$directory$file\";\n";
echo "width[$i]=$width;\n";
echo "height[$i]=$height;\n";
$i++;
}
}
closedir($dir);
?>
function $(div) {
return document.getElementById(div);
}
function loadImage() {
while(width[0]>screen.width-200 || height[0]>screen/height-200) {width[0]/=2; height[0]/=2;}
$('image').src=links[0];
$('image').style.left=screen.width/2-width[0]/2;
$('image').style.top=screen.height/2-height[0]/2-50;
$('image').style.width=width[0];
$('image').style.height=height[0];
}
var curr=0;
function next() {
if(curr==links.length-1) return;
curr++;
while(width[curr]>screen.width-200 || height[curr]>screen/height-200) {width[curr]/=2; height[curr]/=2;}
$('image').src=links[curr];
$('image').style.left=screen.width/2-width[curr]/2;
$('image').style.top=screen.height/2-height[curr]/2-50;
$('image').style.width=width[curr];
$('image').style.height=height[curr];
}
function previous() {
if(curr==0) return;
curr--;
while(width[curr]>screen.width-200 || height[curr]>screen/height-200) {width[curr]/=2; height[curr]/=2;}
$('image').src=links[curr];
$('image').style.left=screen.width/2-width[curr]/2;
$('image').style.top=screen.height/2-height[curr]/2-50;
$('image').style.width=width[curr];
$('image').style.height=height[curr];
}
function key() {
var keyid=event.keyCode;
if(keyid==37) {previous(); $('prevlink').style.color="#ffffff";}
if(keyid==39) {next(); $('nextlink').style.color="#ffffff";}
}
function key1() {
var keyid=event.keyCode;
if(keyid==37) $('prevlink').style.color="#00ffff";
if(keyid==39) $('nextlink').style.color="#00ffff";
}
</script>
</head>
<body onload="loadImage();" onkeydown="key1();" onkeyup="key();">
<div id="title">TechnoForce Simple Gallery</div>
<img id="image" alt="Image" />
<div id="links"><a href="javascript:void(0);" onclick="previous();" id="prevlink"><<</a> <a href="javascript:void(0);" onclick="next();" id="nextlink">>></a></div>
</body>
</html>
Урока е от вашия сайт.
Благодаря предварително.
EDIT: Оправих се ... може да локнете темата!