Text Size
Sunday, May 20, 2012
Get a look down
General >> Displaying items by tag: JS
Displaying items by tag: JS

Here's how you can make a string translatable in your javascript files loaded in Drupal.

1
2
3
4
5
6
7
8
// This little code will append a <div> to the body.
// The <div> contains a translatable string "Hello world!"
// You can translate this string easily in the Back office
// of your website by browsing this url : 
// http://you.website.here/admin/build/translate/search
// and search for Hello world!
// PS : it's a case sensitive input
$('<div>'+Drupal.t("Hello world!")+'</div>').appendTo('body');
Published in Code snippets

We gonna see in this article how it is easy to create our own simple accordion system using the Mootools library. Of course there are lot of Mootools plugins that allow us to create such system in our websites, but sometimes we need really a simple way to do the job, and in this case, this tutorial can make your life easier. So take your keyboards and let's do it!

Published in JavaScript
Monday, 16 August 2010 15:45

How to preload a page using mootools

Some web site contains a large number of images, scripts or stylesheets even after optimization of various pages. This slow loading, and the end user just does not perhaps understand that the page is being loaded when he sees everywhere broken divs, or images half loaded.

In this small article I will show you a trick that allows you to make a preloading image on your site, which will disappear once the page is loaded, using the Mootools framework.

Published in JavaScript
Usefull tricks