1

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!

3 Answers 3

1

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()

3
  • 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
    Commented Dec 2, 2011 at 4:49
  • your $().timelinr(){}; lacks where it should be applied. $("#IDsomething").timelinr(){} ps: you can upvote the answers you like. Arrow up. Commented Dec 2, 2011 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
    Commented Dec 8, 2011 at 20:41
1

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.

1
  • 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
    Commented Dec 2, 2011 at 4:53
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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