Tell me more ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I have found this awesome jQuery Timelinr that I have customized for my Drupal site but am now at a loss at how to insert it. It is only going to be on one page. Does it need to be in a block? Do I have to make a custom module? Any assistance would be greatly appreciated!

share|improve this question
add comment (requires an account with 50 reputation)

3 Answers

There are many ways to do it. Easy one is to add it on your theme's .info file: scripts[] = js/your_jquery_plugin.js But then its everywhere.

You can add it in a block. Check that your text-filter is set to PHP (May need to be active in the modules: PHP filter). Then add drupal_add_js()

share|improve this answer
Thank you so much for your reply! I went ahead and used the drupal_add_js() in a page as suggested above. I am still having trouble with the formatting of the function. How do I drupalize it? $(function(){ $().timelinr({ orientation: 'vertical', issuesSpeed: 300, datesSpeed: 100, issuesSpeed: 500, arrowKeys: 'true', startAt: 3 }) }); – Steph Dec 2 '11 at 4:49
your $().timelinr(){}; lacks where it should be applied. $("#IDsomething").timelinr(){} ps: you can upvote the answers you like. Arrow up. – whitefleaCH Dec 2 '11 at 8:46
Sorry I have been MIA. It's finals week. That bit of code above works without anything on a regular page, just not in drupal. I tried putting the timeline div name (as that is where it should be applied) but that still does not work. The jquery is loading and I put all the necessary markup in the body but it is still a no go. Anything else you could suggest? – Steph Dec 8 '11 at 20:41
add comment (requires an account with 50 reputation)

If it's only o one page you can also create a plane new page set the text filter to PHP and add the drupal_add_js() code.

See here for some hints about integrating custom jQuery code into Drupal.

share|improve this answer
Thanks for your help! I used your suggestion but am still having trouble formatting the function (see below). Let me know if you have any ideas on that. Thanks! – Steph Dec 2 '11 at 4:53
add comment (requires an account with 50 reputation)

Did you resolve it meanwhile? If not, I suppose it is because of jquery-version conflicts. The Drupal built-in version is NOT new enough for this script; even the jQuery Update module does not bring the newest version. I had the same problem when trying to implement another jQuery script. I resolved it by removing the built-in jQuery and adding the new one. I did that in the page template. I know, it is not recommended.

share|improve this answer
add comment (requires an account with 50 reputation)

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.