PHP interesse |
|
Hallo,
Ik heb de volgende code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Loader - Mootools</title>
<style type="text/css">
.bar {
width: 70%;
height: 30px;
border: 1px solid #000;
background-color: #A1571E;
}
.bar_loaded_start {
width: 0%;
height: 30px;
background-color: #2A31A1;
}
.bar_loaded_end {
width: 100%;
height: 30px;
background-color: #2A31A1;
}
</style>
<script type="text/javascript" src="mootools.js"></script>
<script type="text/javascript">
Fx.Morph = Fx.Styles.extend({
start: function(className){
var to = {};
$each(document.styleSheets, function(style){
var rules = style.rules || style.cssRules;
$each(rules, function(rule){
if (!rule.selectorText.test('\.' + className + '$')) return;
Fx.CSS.Styles.each(function(style){
if (!rule.style || !rule.style[style]) return;
var ruleStyle = rule.style[style];
to[style] = (style.test(/color/i) && ruleStyle.test(/^rgb/)) ? ruleStyle.rgbToHex() : ruleStyle;
});
});
});
return this.parent(to);
}
});
Fx.CSS.Styles = ["backgroundColor", "backgroundPosition", "color", "width", "height", "left", "top", "bottom", "right", "fontSize", "letterSpacing", "lineHeight", "textIndent", "opacity"];
Fx.CSS.Styles.extend(Element.Styles.padding);
Fx.CSS.Styles.extend(Element.Styles.margin);
Element.Styles.border.each(function(border){
['Width', 'Color'].each(function(property){
Fx.CSS.Styles.push(border + property);
});
});
var myMorph = new Fx.Morph('loader', {wait: false});
$('start_loader').addEvent('click', function(e){
new Event(e).stop();
myMorph.start('bar_loaded_end');
});
</script>
</head>
<body>
<div class="bar"><div id="loader" class="bar_loaded_begin"></div></div><br />
<a href="#" id="start_loader">Start Loader</a>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Loader - Mootools</title> <style type="text/css"> .bar { width: 70%; height: 30px; border: 1px solid #000; background-color: #A1571E; } .bar_loaded_start { width: 0%; height: 30px; background-color: #2A31A1; } .bar_loaded_end { width: 100%; height: 30px; background-color: #2A31A1; } </style> <script type="text/javascript" src="mootools.js"></script> <script type="text/javascript"> Fx.Morph = Fx.Styles.extend({ start: function(className){ var to = {}; $each(document.styleSheets, function(style){ var rules = style.rules || style.cssRules; $each(rules, function(rule){ if (!rule.selectorText.test('\.' + className + '$')) return; Fx .CSS .Styles .each(function(style ){ if (!rule.style || !rule.style[style]) return; var ruleStyle = rule.style[style]; to[style] = (style.test(/color/i) && ruleStyle.test(/^rgb/)) ? ruleStyle.rgbToHex() : ruleStyle; }); }); }); return this.parent(to); } }); Fx.CSS.Styles = ["backgroundColor", "backgroundPosition", "color", "width", "height", "left", "top", "bottom", "right", "fontSize", "letterSpacing", "lineHeight", "textIndent", "opacity"]; Fx.CSS.Styles.extend(Element.Styles.padding); Fx.CSS.Styles.extend(Element.Styles.margin); Element .Styles .border .each(function(border ){ ['Width', 'Color'].each(function(property ){ Fx.CSS.Styles.push(border + property); }); }); var myMorph = new Fx.Morph('loader', {wait: false}); $('start_loader').addEvent('click', function(e){ new Event(e).stop(); myMorph.start('bar_loaded_end'); }); </script> </head> <body> <div class="bar"><div id="loader" class="bar_loaded_begin"></div></div><br /> <a href="#" id="start_loader">Start Loader</a> </body> </html>
nu is de bedoeling dat de loader van hoger wordt. Alleen gebeurd er niks.
Edit
Het probleem is al gevonden. Ik heb nu dir:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Loader - Mootools</title>
<style type="text/css">
.bar {
width: 100%;
height: 30px;
border: 1px solid #000;
background-color: #A1571E;
}
.bar_loaded_start {
width: 0%;
height: 30px;
background-color: #2A31A1;
}
.bar_loaded_end {
width: 100%;
height: 30px;
background-color: #000;
}
</style>
<script type="text/javascript" src="mootools.js"></script>
<script type="text/javascript">
window.addEvent('domready', function() {
Fx.Morph = Fx.Styles.extend({
start: function(className){
var to = {};
$each(document.styleSheets, function(style){
var rules = style.rules || style.cssRules;
$each(rules, function(rule){
if (!rule.selectorText.test('\.' + className + '$')) return;
Fx.CSS.Styles.each(function(style){
if (!rule.style || !rule.style[style]) return;
var ruleStyle = rule.style[style];
to[style] = (style.test(/color/i) && ruleStyle.test(/^rgb/)) ? ruleStyle.rgbToHex() : ruleStyle;
});
});
});
return this.parent(to);
}
});
Fx.CSS.Styles = ["backgroundColor", "backgroundPosition", "color", "width", "height", "left", "top", "bottom", "right", "fontSize", "letterSpacing", "lineHeight", "textIndent", "opacity"];
Fx.CSS.Styles.extend(Element.Styles.padding);
Fx.CSS.Styles.extend(Element.Styles.margin);
Element.Styles.border.each(function(border){
['Width', 'Color'].each(function(property){
Fx.CSS.Styles.push(border + property);
});
});
var myMorph = new Fx.Morph('loader', {wait: false});
$('start_loader').addEvent('click', function(e){
new Event(e).stop();
myMorph.start('bar_loaded_end');
});
});
</script>
</head>
<body>
<div class="bar"><div id="loader" class="bar_loaded_start"></div></div><br />
<a href="#" id="start_loader">Start Loader</a>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Loader - Mootools</title> <style type="text/css"> .bar { width: 100%; height: 30px; border: 1px solid #000; background-color: #A1571E; } .bar_loaded_start { width: 0%; height: 30px; background-color: #2A31A1; } .bar_loaded_end { width: 100%; height: 30px; background-color: #000; } </style> <script type="text/javascript" src="mootools.js"></script> <script type="text/javascript"> window.addEvent('domready', function() { Fx.Morph = Fx.Styles.extend({ start: function(className){ var to = {}; $each(document.styleSheets, function(style){ var rules = style.rules || style.cssRules; $each(rules, function(rule){ if (!rule.selectorText.test('\.' + className + '$')) return; Fx .CSS .Styles .each(function(style ){ if (!rule.style || !rule.style[style]) return; var ruleStyle = rule.style[style]; to[style] = (style.test(/color/i) && ruleStyle.test(/^rgb/)) ? ruleStyle.rgbToHex() : ruleStyle; }); }); }); return this.parent(to); } }); Fx.CSS.Styles = ["backgroundColor", "backgroundPosition", "color", "width", "height", "left", "top", "bottom", "right", "fontSize", "letterSpacing", "lineHeight", "textIndent", "opacity"]; Fx.CSS.Styles.extend(Element.Styles.padding); Fx.CSS.Styles.extend(Element.Styles.margin); Element .Styles .border .each(function(border ){ ['Width', 'Color'].each(function(property ){ Fx.CSS.Styles.push(border + property); }); }); var myMorph = new Fx.Morph('loader', {wait: false}); $('start_loader').addEvent('click', function(e){ new Event(e).stop(); myMorph.start('bar_loaded_end'); }); }); </script> </head> <body> <div class="bar"><div id="loader" class="bar_loaded_start"></div></div><br /> <a href="#" id="start_loader">Start Loader</a> </body> </html>
nu is, als ik op de link klik, de bar zo'n 15% van de lengte van wat hij moet zijn
|