1
I have some problems with document.addEventListener("DOMContentLoaded"
in the following section. I can only get the values of list
when I activate the Ctrl+F5. I need to have it when first loaded. I can use onload
in Istener? Thank you.
document.addEventListener("DOMContentLoaded", function(e) {
console.log('state2',document.readyState);
var list = document.getElementsByClassName( 'morph-button1' );
console.log('list',list.length);
var i;
for(i=0; i < list.length; i++){
console.log('list iteration', list);
console.log('list index', i);
new UIMorphingButton( list[i], {
closeEl : '.icon-close',
onBeforeOpen : function() {
// don't allow to scroll
noScroll();
},
onAfterOpen : function() {
// can scroll again
canScroll();
console.log(list[i]);
},
onBeforeClose : function() {
// don't allow to scroll
noScroll();
},
onAfterClose : function() {
// can scroll again
canScroll();
}
} );
}
});
opa, this occurs even in the html elements being created in Document? because the query and view comes from the database all by javascript.
– Fernando Santana