在Bootstrap Drupal中嵌入Readmore.js插件

时间:2014-04-17 04:38:17

标签: javascript twitter-bootstrap drupal jquery-plugins element

我不能为我的生活让这个工作 - 我想我做的事情相当愚蠢 - 我检查了网站它正在调用正确的插件(添加到我的.info文件中)但无论出于何种原因它只是简单什么也没做。我把它设置为开发人员正在使用的文章元素上的功能。如果有人能解释为什么没有正确调用,请。

<script src="/sites/all/themes/bootstrap/js/bootstrap.js?n45oaf/bootstrap/js/readmore.js"></script>
<script>
$('article').readmore();
</script>

<article class ="textwritten" style={height: 50px; overflow: hidden;}>
<a  class = "link" href= "/?q=node/11">
  <img class = "bordered_img" src="/sites/all/themes/bootstrap_tsunami/assets/tsusafety_icon.png">
  </img>
  <h1>Tsunami Safety Resources</h1>
</a>
<p>Lorem ipsum + more blabbity blah<p>
</article>

1 个答案:

答案 0 :(得分:1)

无法直接在drupal 7中调用Javascript。 Drupal 7将它放在命名空间中。

这是一个例子。

jQuery(function ($) { 
    // your jquery code here
});