Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何将jquery slidetoggle用于多个内容框?_Javascript_Jquery_Html - Fatal编程技术网

Javascript 如何将jquery slidetoggle用于多个内容框?

Javascript 如何将jquery slidetoggle用于多个内容框?,javascript,jquery,html,Javascript,Jquery,Html,我的页面中有一些内容框,我需要在这些内容框下切换一些内容 我的内容框如下所示: <div class="package"> <div class="banner-wrap"> <figure class="featured-thumbnail"> <a href="#"> <img src="img/packages/package1.png" alt=""/&g

我的页面中有一些内容框,我需要在这些内容框下切换一些内容

我的内容框如下所示:

<div class="package">
    <div class="banner-wrap">
        <figure class="featured-thumbnail">
            <a href="#">
                <img src="img/packages/package1.png" alt=""/>
            </a>
        </figure>
        <div class="event">
            <p class="readmore">read more <i class="fa fa-chevron-circle-down"></i></p>
        </div>

        <div class="more-info">
            <p>----- this is my toggling contents ---- </p>
        </div>
    </div> 
</div>

<div class="package">
    <div class="banner-wrap">
        <figure class="featured-thumbnail">
            <a href="#">
                <img src="img/packages/package1.png" alt=""/>
            </a>
        </figure>
        <div class="event">
            <p class="readmore">read more <i class="fa fa-chevron-circle-down"></i></p>
        </div>

        <div class="more-info">
            <p>----- this is my toggling contents ---- </p>
        </div>
    </div> 
</div>

<div class="package">
    <div class="banner-wrap">
        <figure class="featured-thumbnail">
            <a href="#">
                <img src="img/packages/package1.png" alt=""/>
            </a>
        </figure>
        <div class="event">
            <p class="readmore">read more <i class="fa fa-chevron-circle-down"></i></p>
        </div>

        <div class="more-info">
            <p>----- this is my toggling contents ---- </p>
        </div>
    </div> 
</div>
有人能告诉我如何修改这个代码吗

$(“.readmore”)。单击(函数(){
var txt=$(this.parent().next(.more info”).is(':visible')?“Read more”:“hide”;
console.log(txt);
$(this.text(txt.parent().sides(“.more info”).slideToggle()
});
。更多信息{
显示:无;
}

阅读更多

-----这是我的切换内容----

阅读更多

-----这是我的切换内容----

阅读更多

-----这是我的切换内容----

$(“.readmore”)。单击(函数(){
var txt=$(this.parent().next(.more info”).is(':visible')?“Read more”:“hide”;
console.log(txt);
$(this.text(txt.parent().sides(“.more info”).slideToggle()
});
。更多信息{
显示:无;
}

阅读更多

-----这是我的切换内容----

阅读更多

-----这是我的切换内容----

阅读更多

-----这是我的切换内容----

$(“.readmore”)。单击(函数(){
var txt=$(this.parent().next(.more info”).is(':visible')?“Read more”:“hide”;
console.log(txt);
$(this.text(txt.parent().sides(“.more info”).slideToggle()
});
。更多信息{
显示:无;
}

阅读更多

-----这是我的切换内容----

阅读更多

-----这是我的切换内容----

阅读更多

-----这是我的切换内容----

$(“.readmore”)。单击(函数(){
var txt=$(this.parent().next(.more info”).is(':visible')?“Read more”:“hide”;
console.log(txt);
$(this.text(txt.parent().sides(“.more info”).slideToggle()
});
。更多信息{
显示:无;
}

阅读更多

-----这是我的切换内容----

阅读更多

-----这是我的切换内容----

阅读更多

-----这是我的切换内容----

查看以下内容:

$(".readmore").click(function () {
    var $this = $(this);
    $this.parent().siblings(".more-info").slideToggle().promise().done(function () {
        $this.html($(this).is(':visible') ? "read less <i class='fa fa-chevron-circle-up'></i>" : "read more <i class='fa fa-chevron-circle-down'></i>");
    });
});
$(“.readmore”)。单击(函数(){
var$this=$(this);
$this.parent().sides(“.more info”).slideToggle().promise().done(函数(){
$this.html($(this.is(':visible')?“少读”:“多读”);
});
});
或者干脆

$(".readmore").click(function () {
    var $this = $(this);
    $this.parent().siblings(".more-info").slideToggle(function () {
        $this.html($(this).is(':visible') ? "read less <i class='fa fa-chevron-circle-up'></i>" : "read more <i class='fa fa-chevron-circle-down'></i>");
    });
});
$(“.readmore”)。单击(函数(){
var$this=$(this);
$this.parent().sides(“.more info”).slideToggle(函数(){
$this.html($(this.is(':visible')?“少读”:“多读”);
});
});

查看以下内容:

$(".readmore").click(function () {
    var $this = $(this);
    $this.parent().siblings(".more-info").slideToggle().promise().done(function () {
        $this.html($(this).is(':visible') ? "read less <i class='fa fa-chevron-circle-up'></i>" : "read more <i class='fa fa-chevron-circle-down'></i>");
    });
});
$(“.readmore”)。单击(函数(){
var$this=$(this);
$this.parent().sides(“.more info”).slideToggle().promise().done(函数(){
$this.html($(this.is(':visible')?“少读”:“多读”);
});
});
或者干脆

$(".readmore").click(function () {
    var $this = $(this);
    $this.parent().siblings(".more-info").slideToggle(function () {
        $this.html($(this).is(':visible') ? "read less <i class='fa fa-chevron-circle-up'></i>" : "read more <i class='fa fa-chevron-circle-down'></i>");
    });
});
$(“.readmore”)。单击(函数(){
var$this=$(this);
$this.parent().sides(“.more info”).slideToggle(函数(){
$this.html($(this.is(':visible')?“少读”:“多读”);
});
});

查看以下内容:

$(".readmore").click(function () {
    var $this = $(this);
    $this.parent().siblings(".more-info").slideToggle().promise().done(function () {
        $this.html($(this).is(':visible') ? "read less <i class='fa fa-chevron-circle-up'></i>" : "read more <i class='fa fa-chevron-circle-down'></i>");
    });
});
$(“.readmore”)。单击(函数(){
var$this=$(this);
$this.parent().sides(“.more info”).slideToggle().promise().done(函数(){
$this.html($(this.is(':visible')?“少读”:“多读”);
});
});
或者干脆

$(".readmore").click(function () {
    var $this = $(this);
    $this.parent().siblings(".more-info").slideToggle(function () {
        $this.html($(this).is(':visible') ? "read less <i class='fa fa-chevron-circle-up'></i>" : "read more <i class='fa fa-chevron-circle-down'></i>");
    });
});
$(“.readmore”)。单击(函数(){
var$this=$(this);
$this.parent().sides(“.more info”).slideToggle(函数(){
$this.html($(this.is(':visible')?“少读”:“多读”);
});
});

查看以下内容:

$(".readmore").click(function () {
    var $this = $(this);
    $this.parent().siblings(".more-info").slideToggle().promise().done(function () {
        $this.html($(this).is(':visible') ? "read less <i class='fa fa-chevron-circle-up'></i>" : "read more <i class='fa fa-chevron-circle-down'></i>");
    });
});
$(“.readmore”)。单击(函数(){
var$this=$(this);
$this.parent().sides(“.more info”).slideToggle().promise().done(函数(){
$this.html($(this.is(':visible')?“少读”:“多读”);
});
});
或者干脆

$(".readmore").click(function () {
    var $this = $(this);
    $this.parent().siblings(".more-info").slideToggle(function () {
        $this.html($(this).is(':visible') ? "read less <i class='fa fa-chevron-circle-up'></i>" : "read more <i class='fa fa-chevron-circle-down'></i>");
    });
});
$(“.readmore”)。单击(函数(){
var$this=$(this);
$this.parent().sides(“.more info”).slideToggle(函数(){
$this.html($(this.is(':visible')?“少读”:“多读”);
});
});

如果您在Snippet或on中创建演示,效果会更好。@divy3993谢谢,我用当前代码创建了一个演示-如果您在Snippet或on中创建演示,也可以更好地使用引导折叠。@divy3993谢谢,我用当前代码创建了一个演示-如果您在Snippet或on中创建演示,您也可以更好地使用引导折叠。@divy3993谢谢,我用当前代码创建了一个演示-如果您在Snippet或on中创建演示,您也可以更好地使用引导折叠。@divy3993谢谢,我用我当前的代码创建了一个演示-你也可以使用引导折叠是它的工作。但还有一个问题。当我尝试更改
时,请使用幻灯片切换阅读更多
文本。信息技术