jquery - 如何在jQuery Expander插件中使用jQuery的 "slideDown"和 "slideUp"效果?

标签 jquery jquery-plugins scroll jquery-effects

我正在使用jQuery Expander插入。我希望它使用 jQuery 的 SlideUp 和 SlideDown 之类的效果,而不是默认的 fadeIn。

有人可以告诉我该怎么做吗?

以下是默认选项:

$.fn.expander.defaults = {
  slicePoint:       100,      // the number of characters at which the contents will be sliced into two parts. 
                              // Note: any tag names in the HTML that appear inside the sliced element before 
                              // the slicePoint will be counted along with the text characters.
  widow:            4,        // a threshold of sorts for whether to initially hide/collapse part of the element's contents. 
                              // If after slicing the contents in two there are fewer words in the second part than 
                              // the value set by widow, we won't bother hiding/collapsing anything.
  expandText:       'read more...',   // text displayed in a link instead of the hidden part of the element. 
                              // clicking this will expand/show the hidden/collapsed text
  expandPrefix:     '… ', // text to come before the expand link                              
  collapseTimer:    0,        // number of milliseconds after text has been expanded at which to collapse the text again
  expandEffect:     'fadeIn',
  expandSpeed:      '',       // speed in milliseconds of the animation effect for expanding the text
  userCollapse:     true,     // allow the user to re-collapse the expanded text.
  userCollapseText: '[collapse expanded text]',  // text to use for the link to re-collapse the text
  userCollapsePrefix: ' ', // text to come before the re-collapse link
  beforeExpand: function($thisEl) {}, // function that is called immediately upon expanding, before the expand occurs
  afterExpand: function($thisEl) {}, // function that is called after the details have finished expanding
  onCollapse: function($thisEl, byUser) {} //function that is called when the details are collapsed (immediately after)

};

最佳答案

只需使用$('#yourthing').expander(),默认情况下它使用slideDown和slideUp。

检查第 52 和 54 行 http://plugins.learningjquery.com/expander/jquery.expander.js — 它没有使用您提到的默认值。

关于jquery - 如何在jQuery Expander插件中使用jQuery的 "slideDown"和 "slideUp"效果?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5783996/

相关文章:

javascript - 如何将图像标题添加到 jQuery ImageViewer 插件中的事件项目?

jquery - 如果选择了一个类别,如何隐藏产品树中的其他类别

wpf - WPF ListView 中部分显示项目的烦人自动滚动

javascript - 滑动条触发器不起作用(又名滑动条)

jQuery superfish 菜单/悬停在 iPad、iPhone 等上

javascript - 有没有办法让我在元素的子元素上运行 jquery 函数?

javascript - 如何阻止图像在达到某个点后缩小?

jquery - 我可以在 JQuerify 等书签中使用 JQuery 插件吗

javascript - 防止 ipad/iphone safari 中的弹性滚动,但允许内容滚动

javascript - AngularJS 无限滚动,不只适用于 chrome 全屏