IN case no ones responded.
The Drupal.beavoirs.mybehaviorname = {attach :Mycustomdocumentreadyfunction } is a direct replacement for the document.ready override. You should always use this form in drupal to make sure that you don't have multiple javascript files/functions overidding document.read. Whether you move the code up into your zeroPoint behavior or whether you create a new behavior on the Drupal.behaviors object is a matter of code organization and totally up to you.
Dave
From: support-bounces@drupal.org [mailto:support-bounces@drupal.org] On Behalf Of Yani Sent: Friday, May 31, 2013 7:32 PM To: support@drupal.org Subject: [support] Jquery code revision...
I need a hint on this... I've mentioned it before but couldn't get my head around it and put it in the too hard basket. Of course it has come back and bitten me again.
What's happening is my JS code is causing some other code to break.
There are 2 ways I've used the JS...
________________________________
(function($) {
Drupal.behaviors.zeroPoint = {
attach : function(context, settings) {
//Drupal Jquery wrapper
Button items in here that call functions
//end wrapper
}
}
})(jQuery);
// Note the wrapper is different for Drupal Behaviors
________________________________
function manageBlocks(menu) {( function($) {
$(document).ready(function() {
// jQuery wrapper
Functions actions in here
//end wrapper
});
})(jQuery);
}
________________________________
Can I just lift the functions up and place them within the top section or do I need to write the bottom section differently.
It just seems odd that this wouldn't be correct as is.
The sort of things it impacts are Facebook blocks that don't update and the file upload MCE losses all JS abilities.
Note... it's been 12 months since I've touched this and I'm most brain dead on it!
Yani