当使用" white-space:pre-wrap"时,使用动态书写文本进行对齐

时间:2017-07-13 21:37:42

标签: html css

我正在努力解决项目的细节,但我看不到任何解决方案。我们从MySQL bdd获取Ai编写的数据并以奇特的方式显示为文本http://82.223.18.239/writing.php

正如您所看到的,文字在开始时没有正确证明,当写作过程到达页面底部时,我不知道如何解决这个问题。当"白色空间:预包装"没有使用,一切正常,但我失去了线跳。有什么帮助吗?

我们的wip代码

<head>
   <div id="header"></div>
   <div id="body"></div>
   <div id="footer"></div>

    <script type = "text/javascript" src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>

    <style type="text/css"> 
        #myTable{ 
           width:"90%";
           min-width:250px;
           white-space: pre-wrap;
           word-wrap:break-word;
           position:absolute;
           border:solid 0px;
           top:200px;
           left:720px;
           right:720px;
           bottom:50px;
           font-family:"Times New Roman", Times, serif;
           text-align:justify
        } 

        #body       {
            padding-bottom:60px;
            height:2px;
                   }

   </style> 

</head>

<body>
    <div id="myTable"> <div>

    <script type="text/javascript">  
        var skip = 0;
        function get_data(index) {
            $.ajax({
                url : 'getData.php',
                type : 'POST',
                data: ({"skip":skip}),
                success : function(data) { 
                    if(data && data.trim()!='') {
                        skip = skip+1;
                        showText("#myTable", data, 0, 2); 
                    }
                    else {
                        setTimeout(function () { get_data(skip); }, 30000);
                    }
                },
                error : function(request,error)
                {
                    alert("Request error : "+JSON.stringify(request));
                }
            });
        }

        function showText(target, message, index, interval) {   
            if (index < message.length) {
                $(target).append(message[index++]);
                setTimeout(function () { showText(target, message, index, interval); }, interval);
            }
            else {
                get_data(skip);
            }
        }

        //var period = 10000; //NOTE: period is passed in milliseconds
        get_data(skip);
        //setInterval(page_refresh, period); 
    </script>

</body>

0 个答案:

没有答案