首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用于Wordpress首页的Jquery Read-more滑块

用于Wordpress首页的Jquery Read-more滑块
EN

Stack Overflow用户
提问于 2012-02-06 03:17:07
回答 1查看 659关注 0票数 0

您好,我一直在使用wordpress的“滑动阅读更多”插件来扩展首页中的阅读后文本。这个插件工作得很好。但我需要它也水平扩展时,阅读更多的链接被点击。目前,它只是在div空间上第二次单击时才水平扩展。网址是: www.platformbk.nl --谢谢!

代码如下:

代码语言:javascript
复制
var $jslide = jQuery.noConflict();

$jslide(document).ready(function() {

// MY CODE BELOW
var modWidth = 679;
var origWidth = 326;

$('div.box-content').click(function () {
$(this).width(modWidth);
});

// initialise the visibility check
var is_visible = false;

// append show/hide links to the element directly preceding the element with a class of        "toggle"
$jslide('.toggle').prev().append(' <a href="#" class="toggleLink">'+showText+'</a>');

// hide all of the elements with a class of 'toggle'
$jslide('.toggle').hide();

// capture clicks on the toggle links
$jslide('a.toggleLink').click(function() {

// switch visibility
is_visible = !is_visible;


// change the link depending on whether the element is shown or hidden
$jslide(this).html( (!is_visible) ? showText : hideText);

// toggle the display - uncomment the next line for a basic "accordion" style
//$('.toggle').hide();$('a.toggleLink').html(showText);
$jslide(this).parent().next('.toggle').toggle('slow');

// return false so any link destination is not followed
return false;
});
});
EN

回答 1

Stack Overflow用户

发布于 2012-02-22 18:11:31

尝试替换此行:

代码语言:javascript
复制
$jslide(this).parent().next('.toggle').toggle('slow');

通过以下方式:

代码语言:javascript
复制
$jslide(this).parent().parent().animate({width: '679'}, {duration: "slow" });
$jslide(this).parent().next('.toggle').animate({width: '679'}, {duration: "slow" });

然后可能会将其封装在条件块中,以便在切换时将其调整回以前的宽度。

但是你可能会遇到其他的问题,比如你的div框和其他的重叠等等。

希望这能有所帮助。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/9152173

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档