0.0.1 • Published 2 years ago
gdom-0.0.1 v0.0.1
gdom.js
JS library to handle DOM
Import library from CDN
<script src="https://cdn.underdevelopment.work/generaljs/gdom.min.js">
How to init the library
genrl.run(function(){
//write code below
});
How to select a DOMElement By ID
g("#element");
How to select a DOMElement By ClassName
g(".element");
How to set CSS attributes
g("#element").css({
'height': '400px',
'width': '200px',
'opacity': '1'
});
Bind an event
g("#btnmover").click(function(){
g("#div_A").animate('bounce',5000,function(){
genrl.log("Se ha activado el callBack");
});
});
How to get an attribute of a DOMElement
idelement=g("#element").getAttrb("id");
How to set an attribute of a DOMElement
g("#element").setAttrb("attribRandom","test");
Get element children
g("#element").children();
Get element child number N
g("#element").child(N);
Get fileList from file input when it changes
archivo is a file input
g('#archivo').change(function(e){
console.log("Cambió el campo");
dataf=g('#archivo').getFiles();
});
Smooth scrolling
g("#holap").click(function(){
g("#holap").smooth("#adiosp",{
duration:'10000',
offset: 0,
callback: function(){
g.log("Scroll finalizado");
}
});
});
Use the Source...
The Source be with you...
0.0.1
2 years ago