简体   繁体   English

slideDown不起作用 <div> jQuery的

[英]slideDown not working on <div> Jquery

I have it set to a div, not a span, I have the width and height of said div set in the CSS file, I think I have all the syntax properly set out, (since show/toggle work just fine), I just can't find a way to fix this. 我将其设置为div,而不是跨度,我在CSS文件中设置了该div的宽度和高度,我想我已经正确设置了所有语法,(因为show / toggle工作就很好了),我只是找不到解决此问题的方法。 The in question is contained within a div class="col-md-4" which is contained within div class= "container". 该问题包含在div class =“ col-md-4”中,该类包含在div class =“ container”中。 The text is already hidden when you open the page, so that isn't the problem. 当您打开页面时,该文本已被隐藏,所以这不是问题。 Hence, I haven't been able to find the answers. 因此,我一直找不到答案。 I basically just want the website user to click "View details", have the div slide down displaying text, the button to change to "Hide details"(this part works fine), then the Div to dissapear again when "hide details" is clicked. 我基本上只是希望网站用户单击“查看详细信息”,让div向下滑动以显示文本,将按钮更改为“隐藏详细信息”(这部分工作正常),然后当“隐藏详细信息”为点击。

https://jsfiddle.net/LLdmvm7s/3/ on here it seems to work, animation and all, but on the actual webpage it just doesn't. https://jsfiddle.net/LLdmvm7s/3/在这里似乎可以正常工作,可以动画播放,但在实际网页上却不能。 There's no animation, the text doesn't show. 没有动画,文本也不会显示。 I wonder if its the image? 我想知道它的形象吗? I don't know, I'm still a beginner. 我不知道,我还是个初学者。

$(document).ready(function(){
$("#hiddentext1").hide();

    $("#button21").click(function(){
       $("#hiddentext1").slideDown();
       var txt = $(this).text();
       if (txt == "View details")
           {
               $(this).text('Hide details');
           }
       else 
           {
               $(this).text('View details');
           }
 }):     

you miss }); 你想念}); in the end 到底

and there's a : which should be ; 还有一个:应该是;

$(document).ready(function(){
    $("#hiddentext1").hide();

    $("#button21").click(function(){
        $("#hiddentext1").slideToggle();
       var txt = $(this).text();
       if (txt == "View details")
           {
               $(this).text('Hide details');
           }
       else 
           {
               $(this).text('View details');
           }
    });
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM