jQuery looping timer for lessons
UncategorizedI required a looping time to display as a block on The English Farm site to show the amount of time left in a lesson and when breaks are between classes. As an online school, we don’t have a bell to remind students and teachers when to start and finish classes, so I needed a way to remind people when lessons are due to start and finish.
I found this tutorial for a looped timer to work from, and with the help of this post on WebbyKat I added some Javascript to the .info file for my Omega subtheme (for the first time).
This was also a good nugget in the comments, as I had read that one of the down sides of using a .info approach to adding custom js was that “unused css/js could be included where you don’t need it“.
You can use Omega with Delta + Context to load js files selectively. Delta > Configure > Toggle Libraries
But things still did not work until I found that you have to wrap all your jQuery in this in Drupal 7:
(function ($) {
// All your code here
})(jQuery);
Which comes from here in the Drupal documentation.
No comments yet.