您好,我一直在使用wordpress的“滑动阅读更多”插件来扩展首页中的阅读后文本。这个插件工作得很好。但我需要它也水平扩展时,阅读更多的链接被点击。目前,它只是在div空间上第二次单击时才水平扩展。网址是: www.platformbk.nl --谢谢!
代码如下:
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;
});
});发布于 2012-02-22 18:11:31
尝试替换此行:
$jslide(this).parent().next('.toggle').toggle('slow');通过以下方式:
$jslide(this).parent().parent().animate({width: '679'}, {duration: "slow" });
$jslide(this).parent().next('.toggle').animate({width: '679'}, {duration: "slow" });然后可能会将其封装在条件块中,以便在切换时将其调整回以前的宽度。
但是你可能会遇到其他的问题,比如你的div框和其他的重叠等等。
希望这能有所帮助。
https://stackoverflow.com/questions/9152173
复制相似问题