【问题标题】:gpEasy CMS javascript hide/show textgpEasy CMS javascript 隐藏/显示文本
【发布时间】:2013-05-13 18:36:07
【问题描述】:

我目前正在使用 gpEasy CMS,我需要重现此网站上的隐藏/显示效果:http://frontiers.epfl.ch/index.php/Program(程序中的链接)。 我去了代码源并添加了已经在这里的函数showAbstract:

function showAbstract(e){
  f = e;
  var div;
  for(div = e.nextSibling; div.className != "abs"; div = div.nextSibling);

  if (div.style.display=="block"){
    div.style.display="";
  } else {
    div.style.display="block";
  }
  return true;
}

所以我将它添加到我的代码中并使用 class="abs" 来调用它:

<a href="javascript:void(0)" onclick="showAbstract(this)">Matrix completion ...</a>

<div class="abs"> Recent ubiquity ... </div>

不幸的是,我只是显示了文本,但没有达到预期的效果。你有什么想法吗?

谢谢!

【问题讨论】:

    标签: javascript content-management-system gpeasy


    【解决方案1】:

    问题与您如何显示/隐藏

    有关。既然你有 jQuery,我会做这样的事情:
    <a class="show_abstract">Matrix completion ...</a>
    <div class="abs"> Recent ubiquity ... </div>
    

    ..

    <script type="text/javascript">
    $(function(){
        $('.show_abstract').click(function() {
            $(this).next('div.abs').toggle('slow');
        });
    });
    </script>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-06-14
      • 1970-01-01
      • 2013-02-23
      • 1970-01-01
      • 2012-05-17
      • 2017-09-03
      • 2017-02-11
      • 1970-01-01
      相关资源
      最近更新 更多