-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question #5
Comments
Ok, I think you mixed up the old and new syntax. Below is old syntax which accepts function arg,
The new syntax is, $(selector).attrchange({ trackValues: true, /* Default to false, if set to true the event object is updated with old and new value.*/ callback: function (event) { //event - event object //event.attributeName - Name of the attribute modified //event.oldValue - Previous value of the modified attribute //event.newValue - New value of the modified attribute //Triggered when the selected elements attribute is added/updated/removed } }); You can check out the demo and documentation http://meetselva.github.com/attrchange/ Note: Modify your code like below and give it a try, if (settings.observeLightBoxOpen === true) { $('#' + settings.lightBoxOpenSelector).attrchange({ //removed the function trackValues: true, callback: function(e) { // This is the handler function if (e.newValue === 'block') { console.log('Attribute: ' + e.attributeName + ' modified '); mouseEvent = true; } else { console.log('Attribute: ' + e.attributeName + ' not modified '); mouseEvent = false; }; }; }); }; |
i´ll give it a try ! Thank you |
Let me know if it worked for you. |
Hi, if (settings.observeLightBoxOpen === true) {
$('#' + settings.lightBoxOpenSelector).attrchange({ //removed the function
trackValues: true,
callback: function(e) { // This is the handler function
console.log('Attribute: ' + e.attributeName + ' ' + e.oldValue + ' ' + e.attributeName + ' ' + e.newValue + ' changed ');
if (e.newValue === 'block') {
console.log('Attribute: ' + e.attributeName + ' ' + e.oldValue + ' ' + e.attributeName + ' ' + e.newValue + ' modified');
} else {
console.log('Attribute: ' + e.attributeName + ' ' + e.oldValue + ' ' + e.attributeName + ' ' + e.newValue + ' modified');
};
}
}); still using the old way (works): if (settings.observeLightBoxOpen === true) {
$('#' + settings.lightBoxOpenSelector).attrchange(function(attrName) {
var currentDisplay = $('#' + settings.lightBoxOpenSelector).css('display');
if ( currentDisplay === 'block') {
mouseEvent = true;
} else {
mouseEvent = false;
}
});
}
it polls the output multiple time too |
Thank you for this great Work, it really helped me alot !!!
Keep up the great work.
btw. if it´s included in another plugin to observe a change.
how do i use:
from within another plugin.
The text was updated successfully, but these errors were encountered: