D
D
Dmitry Kamyannoy2015-07-09 11:40:50
Drupal
Dmitry Kamyannoy, 2015-07-09 11:40:50

How to properly integrate js scripts in Drupal 7?

Good afternoon geniuses. On the one hand, the question is stupid and perhaps banal, but there is one catch why I ask.

There is a site theme that uses isotope (isotope) I put the script in the info file of the theme. But it often happens that when loading pages, the script does not always work well, or when folding - expanding.
An example of a sharp collapse:
0ae1003fd0e9417496221ae6bad65c43.jpg
But, I know that there is a module for this business with integration into views , where the script works well and without complaints, but unfortunately I cannot use these tools, either strictly the theme or a separate module that will not affect the main theme (my theme only for mobile phones using the mobile_theme module) .

And the question: Since the integration of the isotope with views works well, but the integration into the theme is bad, so there is a way to somehow connect the script differently? (In the sense of integrating a script with a module)
P.S. I did not observe this problem on pure html, but with Drupal or WP this trouble is present and I just think that I am not integrating correctly.
Thank you very much . =)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
pibiv, 2015-07-09
@pibiv

how to connect the script in another way?

Pens write in the right place drupal_add_js ?
https://api.drupal.org/api/drupal/includes!common....
+ do not forget that you need to add conditions to the scripts so that they are loaded only after the information on the page is fully loaded. At the moment, you can track this from the console when loading the page, if there are any errors.
I recently needed to add a simple jquery, for two hours I could not understand why it didn’t work, then it turned out that the script was executed before the necessary elements were loaded

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question