Re-init DOM

45 views
Skip to first unread message

Karim

unread,
Mar 25, 2014, 6:58:29 AM3/25/14
to mootool...@googlegroups.com
Hello guys.
How to reinit DOM after Request?
I use mBox library.
window.addEvents({
domready: function() {
new mBox.Tooltip({
setContent: 'data-tooltip',
attach: $$('*[data-tooltip]')
})
},
})
After Request I'll add new elements in page and if I add an attribute data-tooltip to these elements the they will no work.

Andrea Dessì

unread,
Mar 25, 2014, 7:03:56 AM3/25/14
to MooTools Users
Hi Karim,

you have to trigger some event and reinit manually... something like this:


function initTooltips (selector) {
var selctor = selector || '*[data-tooltip]';
var mtt = new mBox.Tooltip({
setContent: 'data-tooltip',
attach: $$(selector)
})
return mtt;
};

window.addEvents({
domready: function() {
initTooltips()
}
})

//later....
/*
element.addEvent('click', initTooltips)
*/


--
Andrea


--

---
You received this message because you are subscribed to the Google Groups "MooTools Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mootools-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Karim

unread,
Mar 25, 2014, 7:13:26 AM3/25/14
to mootool...@googlegroups.com
Thanks Andrea! Sorry for my carelessness.:)

Andrea Dessì

unread,
Mar 25, 2014, 7:15:56 AM3/25/14
to MooTools Users
you are welcome ;)

--
Andrea


On Tue, Mar 25, 2014 at 12:13 PM, Karim <rosli...@gmail.com> wrote:
Thanks Andrea! Sorry for my carelessness.:)

--

Karim

unread,
Mar 25, 2014, 9:18:59 AM3/25/14
to mootool...@googlegroups.com
I use Lightface
function modal(elem, event) {
new LightFace({
//todo
}).open().load()
}
 
open: function(fast) {
this.fireEvent( 'open' )
this._attachEvents()
this._setFocus();
return this
},

load: function() {
var properties = (Object.append)({
url: 'admin/',
evalScripts: true,
onSuccess: function(response) {
this.messageBox.set( 'html', response ) // response with html elements
this.fireEvent( 'success' )
}.bind(this),
onComplete: function(transport) {
this.unfade()
this.fireEvent( 'complete' )
}.bind(this)
}, this.options.request)
new Request(properties).send()
}

I cant understand where u must use mBox.reInit() after request? 
Reply all
Reply to author
Forward
0 new messages