I have started using omega 4, and it is the best theme ever. But i am having an issue in my jQuery.
I don't know if its omega issue or jquery problem, but i have added jquery.labelify.js in many of my sites and it works like a charm, but for some reason it is giving me an error when i use it with omega 4. And yes i have checked it it is being added in page and before sript.js file.
method of adding file on omega.info file: scripts[] = js/jquery.labelify.js
error : Uncaught TypeError: Property '$' of object [object Object] is not a function (jquery.labelify.js?n1p2j8:41)

Source of jquery.labelify.js : http://www.kryogenix.org/code/browser/labelify/jquery.labelify.js

Help Required

Comments

fubhy’s picture

Try wrapping the labelify code in this:

;(function ($) {

  // LABELIFY CODE HERE;

})(jQuery);
Mujtaba Ahmad’s picture

Still same error. Everything else is working perfect.

Mujtaba Ahmad’s picture

Category: Support request » Bug report
fubhy’s picture

Category: Bug report » Feature request
Status: Active » Postponed (maintainer needs more info)
Issue tags: -java script problems

I need more information to be able to help you. Are you sure that jquery.js is loaded before that library? This is a bug in your JS somewhere, not Omega, as apparently $ is not pointing to jQuery or jquery is missing at the time line 41 is executed. So please make sure that the JS that is executing the script to attach the labelify behavior is running after jquery is loaded.

I really need more information if you want me to help you with this problem. E.g. paste your DOM head to http://privatepaste.com/. In general it's much easier if you debug your JS with a proper IDE, e.g. PHPStorm. That way you can set breakpoints and properly figure out what exactly is causing the problem.

It seems like this line in labelify.js is causing the issue:

 var jQuery_labellified_elements = $(this);

Are you sure that whatever you are using $(foo).labelify() on is actually a proper set of DOM elemetns?

Please paste the code you are using to apply labelify (the Drupal behavior in which you attach the functionality).

steinmb’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)
steinmb’s picture

Category: Feature request » Support request