Hi,

I'm new to drupal and I was wondering if it is a bad practise to just put your jquery code in a js-folder in your theme root to like for example make a slideshow or a dropdown menu. I saw there is a drupal function for using javascript. But its not clear to me what the advantages of that way are?

grz

Comments

francort’s picture

It is alright to have a js folder with your javascript's files on theme's root, if they are used for look and feel(like drop down menus)
They can be called from your theme's .info file.

If you want a slideshow, some modules can do that and you'll have the slides as nodes and you'll be able to edit them easily.

Cheers

beckjonathan’s picture

thx alot,

so the main advantage of drupal_add_js('') is that you can add javascript to a module?

grz

Andy Britton’s picture

Did you have a look through http://drupal.org/node/756722?

beckjonathan’s picture

Thx that clears up alot.

grz

nelsonbranco’s picture

I am confused now, not to say !$...
I am new to drupal (6x) but i did spend my last 1/2 year fulltime busy learning and goofing around 12/24 h...
Confident i started theming from scratch and it was going fine, was loving it... then something went wrong (sorry i wish i knew what..update? module? i have no idea... human error;? so i decided to make it simple and restart all over again, because time was short, theming a zen sub theme was a solution... zen is really well done but later on i got the same problem then before...
So, theming in drupal 6, It was great, not anymore, because, even with a lot of info around i can't manage to avoid conflicts with my own javaScript/jquery files, that sometimes work sometimes not!, because of one or other module or update...or whatever, i wish i knew why;
I am really getting nuts!!!!!!!! because i already missed my deadline (with my first drupal site/cms) and still haven't found a workaround that works all the time.
Like a lot of things in drupal, iam sure that solution is easy, but i need a good drupal_add_js example or tutorial... I tryed it in several difernt ways with no complet result...Can anyone show me the way to the solution to the js/jquery conflicct...
Sometimes i can't see the florest......show me the way...

francort’s picture

It's hard to help you with no clear problem.
If you're still in trouble, make a new thread about the topic.
If you have js problems, it would be easier to help you if you say what's the error you've got or how the js file looks like.

Cheers,