【问题标题】:How to slidedown the div when (page loaded and condition fulfill)如何在(页面加载和条件满足)时向下滑动 div
【发布时间】:2012-12-06 10:55:04
【问题描述】:

以下是我的示例代码。我想加载loading.jsp。 div 默认是不向下滑动的。

<%=msg%> 不为空时。然后 div 将向下滑动。

流:loading.jsp -> servlet (detect error) -> loading.jsp (div slide down)

$("#errorLoading").load(function() {
        if(<%=msg%> != ""){
                $('#errorLoading').slideDown('slow');
        }
});
<div class="alert alert-error" id="errorLoading" name="errorLoading">
<%=msg%>
</div>

谁能帮帮我。

【问题讨论】:

  • 如果你得到你的答案,你会接受吗?
  • div中的错误信息

标签: java jquery jsp servlets


【解决方案1】:

【讨论】:

    【解决方案2】:

    请参阅 you have to use $.trim function of jquery 以检查 if div is filled with the message 您正在使用它进行打印。然后检查一个条件,然后滑动你想要的 div。

    注意:必须先隐藏 div。

    你可以找到小提琴:

    http://jsfiddle.net/wZ6Br/

    you can check with putting some dummy text there.
    
     var divErr = $.trim($('.alert-error').text());
    
    
     if (divErr) {
         $('#errorLoading').slideDown('slow');
     }
    

    【讨论】:

    • 你检查小提琴链接了吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-09-15
    • 1970-01-01
    • 2013-02-08
    • 1970-01-01
    • 2021-12-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多