Hi,
ich habe mir ein script zusammen gebaut, die erste variante funktioniert, wenn ich dann das script erweitern will wie in der zweiten variante bekomme ich einen fehler im IE7.
Variante 1:
Variante 2:
Wo liegt in variante 2 der fehler?
LG & danke
Edit: Die Fehlerkonsole vom IE7 sagt:
SCRIPT5007: Unable to get property 'getElements' of undefined or null reference
Bei der zeile:
UND
in dieser Zeile:
</script>
ich habe mir ein script zusammen gebaut, die erste variante funktioniert, wenn ich dann das script erweitern will wie in der zweiten variante bekomme ich einen fehler im IE7.
Variante 1:
HTML:
<script type="text/javascript">
//<=!=[=C=D=A=T=A=[
window.addEvent('load', function() {
(function(){
var wrap,
overview = document.getElement('div.gl');
overview.getElements('div.wrapper_item').each(function(a, i){
if (i % 5 == 0){
wrap && overview.adopt(wrap);
wrap = new Element('div.new');
}
wrap.adopt(a);
});
overview.adopt(wrap);
}());
});
window.addEvent('domready', function() {
var activeParent = null;
var myAccordion = new Fx.Accordion($$('.item'), $$('.hidden_content'), {
display: -1,
alwaysHide: true,
onActive: function(toggler, element) {
var size = element.getScrollSize();
element.getParent('.new').morph({
'padding-bottom': size.y+'px'
});
activeParent = element.getParent('.new');
},
onBackground: function(toggler, element) {
if(element.getParent('.new') != activeParent) {
element.getParent('.new').morph({
'padding-bottom': '0px'
});
}
},
onComplete: function(toggler, element) {
activeParent = null;
}
});
});
//]=]=>
</script>
Variante 2:
HTML:
<script type="text/javascript">
<!--
var viewportwidth;
var viewportheight;
// the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
if (typeof window.innerWidth != 'undefined')
{
viewportwidth = window.innerWidth,
viewportheight = window.innerHeight
}
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
else if (typeof document.documentElement != 'undefined'
&& typeof document.documentElement.clientWidth !=
'undefined' && document.documentElement.clientWidth != 0)
{
viewportwidth = document.documentElement.clientWidth,
viewportheight = document.documentElement.clientHeight
}
// older versions of IE
else
{
viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
viewportheight = document.getElementsByTagName('body')[0].clientHeight
}
//<=!=[=C=D=A=T=A=[
if (viewportwidth <= '766') {
window.addEvent('load', function() {
(function(){
var wrap,
overview = document.getElement('div.gl');
overview.getElements('div.wrapper_item').each(function(a, i){
if (i % 2 == 0){
wrap && overview.adopt(wrap);
wrap = new Element('div.new');
}
wrap.adopt(a);
});
overview.adopt(wrap);
}());
});
} else {
window.addEvent('load', function() {
(function(){
var wrap,
overview = document.getElement('div.gl');
overview.getElements('div.wrapper_item').each(function(a, i){
if (i % 5 == 0){
wrap && overview.adopt(wrap);
wrap = new Element('div.new');
}
wrap.adopt(a);
});
overview.adopt(wrap);
}());
});
}
window.addEvent('domready', function() {
var activeParent = null;
var myAccordion = new Fx.Accordion($$('.item'), $$('.hidden_content'), {
display: -1,
alwaysHide: true,
onActive: function(toggler, element) {
var size = element.getScrollSize();
element.getParent('.new').morph({
'padding-bottom': size.y+'px'
});
activeParent = element.getParent('.new');
},
onBackground: function(toggler, element) {
if(element.getParent('.new') != activeParent) {
element.getParent('.new').morph({
'padding-bottom': '0px'
});
}
},
onComplete: function(toggler, element) {
activeParent = null;
}
});
});
//]=]=>
</script>
Wo liegt in variante 2 der fehler?
LG & danke
Edit: Die Fehlerkonsole vom IE7 sagt:
SCRIPT5007: Unable to get property 'getElements' of undefined or null reference
Bei der zeile:
HTML:
overview.getElements('div.wrapper_item').each(function(a, i){
HTML:
SCRIPT1002: Syntax error
</script>
Zuletzt bearbeitet: