Hallo ich sitze gerade an einer minimalen Version von einem Slider.
Allerdigns kann ich den Silder-Balken nur einmal verändern. Warum, diese Frage stelle ich mir gerade
Hier mein code:
<style type="text/css">
.clBack{position:absolute;top:50px;right:90px;
background-image: url(images/back.jpg);
width:496px;height:32px;}
.clFront{position:absolute;top:59px;right:560px;
background-image: url(images/front.jpg);
width:24px;height:12px;}
</style>
<script language=JavaScript>
var x_koo;
var y_koo;
var _x;
var _y;
var element;
var Regler;
var erg;
var Offset_x = 560;
var Min_x = 560;
var Max_x = 90;
var active = false;
var isIE = document.all?true:false;
function start()
{
document.onmousemove = getMousePosition;
document.onmouseup = drop;
Regler = document.getElementById("F");
}
function druecken() {
active = true;
x_koo=_x;
y_koo=_y;
//alert("X-position: "+x_koo+"; Y-position: "+y_koo+".");
return true;
}
function drop() {
if(active === true)
{
Offset_x = Regler.style.right;
}
active = false;
return true;
}
function getMousePosition(e) {
var erg;
if (!isIE) {
_x = e.pageX;
_y = e.pageY;
}
if (isIE) {
_x = event.clientX + document.body.scrollLeft;
_y = event.clientY + document.body.scrollTop;
}
if(active === true)
{
erg = Regler.style.right;
erg = Offset_x + x_koo - _x;
if(erg < Max_x)
{
erg = Max_x;
}
else if(erg > Min_x)
{
erg = Min_x;
}
else{}
Regler.style.right = erg;
}
return true;
}
</script>
HTML:
<div id="B" class="clBack"></div>
<div id="F" class="clFront" onmousedown="druecken()" onmouseup="drop()"></div>
Kann mir da jemand eine Antwort geben?
Allerdigns kann ich den Silder-Balken nur einmal verändern. Warum, diese Frage stelle ich mir gerade
Hier mein code:
<style type="text/css">
.clBack{position:absolute;top:50px;right:90px;
background-image: url(images/back.jpg);
width:496px;height:32px;}
.clFront{position:absolute;top:59px;right:560px;
background-image: url(images/front.jpg);
width:24px;height:12px;}
</style>
<script language=JavaScript>
var x_koo;
var y_koo;
var _x;
var _y;
var element;
var Regler;
var erg;
var Offset_x = 560;
var Min_x = 560;
var Max_x = 90;
var active = false;
var isIE = document.all?true:false;
function start()
{
document.onmousemove = getMousePosition;
document.onmouseup = drop;
Regler = document.getElementById("F");
}
function druecken() {
active = true;
x_koo=_x;
y_koo=_y;
//alert("X-position: "+x_koo+"; Y-position: "+y_koo+".");
return true;
}
function drop() {
if(active === true)
{
Offset_x = Regler.style.right;
}
active = false;
return true;
}
function getMousePosition(e) {
var erg;
if (!isIE) {
_x = e.pageX;
_y = e.pageY;
}
if (isIE) {
_x = event.clientX + document.body.scrollLeft;
_y = event.clientY + document.body.scrollTop;
}
if(active === true)
{
erg = Regler.style.right;
erg = Offset_x + x_koo - _x;
if(erg < Max_x)
{
erg = Max_x;
}
else if(erg > Min_x)
{
erg = Min_x;
}
else{}
Regler.style.right = erg;
}
return true;
}
</script>
HTML:
<div id="B" class="clBack"></div>
<div id="F" class="clFront" onmousedown="druecken()" onmouseup="drop()"></div>
Kann mir da jemand eine Antwort geben?