2016-01-22 2 views
-2

У меня 12 квадратов, в которых число 6 имеет прокручиваемое содержимое. но не будет правильно выравниваться по площади, по всему месту. Настройка размера экрана создает другие проблемы. Этот текст отличается по-разному в хром и IE. Мне нужна помощь в выравнивании текста в квадрате 6 и его сохранении независимо от размера экрана или браузера.Проблема с CSS, нужна помощь в исправлении этой проблемы

test not aligning in square6

 <!doctype html> 

    <html lang="en"> 
    <head> 
     <meta charset="utf-8"> 
     <META HTTP-EQUIV=Refresh CONTENT='300; URL=pWebMonitor.html'> 
     <title>Web-Monitor</title> 
     <link rel="stylesheet" href="webMonitor.css"> 
     <script src="jquery-2.1.4.min.js"></script> 


    <script type="text/javascript"> 

    /*Example message arrays for the two demo scrollers*/ 

    var pausecontent=new Array() 
    pausecontent[0]='<li><span class="statusGreen">-000-</span> ....Trying to Load collected Data....</li>' 
    pausecontent[1]='<li><span class="statusGreen">-000-</span> ....Trying to Load collected Data....</li>' 
    pausecontent[2]='<li><span class="statusGreen">-000-</span> ....Trying to Load collected Data....</li>' 

    var pausecontent2=new Array() 


    </script> 

    <script type="text/javascript"> 

    /*********************************************** 
    * Pausing up-down scroller- (c) Dynamic Drive (www.dynamicdrive.com) 
    * Please keep this notice intact 
    * Visit http://www.dynamicdrive.com/ for this script and 100s more. 
    ***********************************************/ 

    function pausescroller(content, divId, divClass, delay){ 
    this.content=content //message array content 
    this.tickerid=divId //ID of ticker div to display information 
    this.delay=delay //Delay between msg change, in miliseconds. 
    this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over scroller (and pause it if it is) 
    this.hiddendivpointer=1 //index of message array for hidden div 
    document.write('<div id="'+divId+'" class="'+divClass+'" style="position: relative;overflow: hidden"><div class="innerDiv" style="position: absolute; width: auto;" id="'+divId+'1">'+content[0]+'</div><div class="innerDiv" style="position: absolute; width: auto; visibility: hidden" id="'+divId+'2">'+content[1]+'</div></div>') 
    var scrollerinstance=this 
    if (window.addEventListener) //run onload in DOM2 browsers 
    window.addEventListener("load", function(){scrollerinstance.initialize()}, false) 
    else if (window.attachEvent) //run onload in IE5.5+ 
    window.attachEvent("onload", function(){scrollerinstance.initialize()}) 
    else if (document.getElementById) //if legacy DOM browsers, just start scroller after 0.5 sec 
    setTimeout(function(){scrollerinstance.initialize()}, 500) 
    } 

    // ------------------------------------------------------------------- 
    // initialize()- Initialize scroller method. 
    // -Get div objects, set initial positions, start up down animation 
    // ------------------------------------------------------------------- 

    pausescroller.prototype.initialize=function(){ 
    this.tickerdiv=document.getElementById(this.tickerid) 
    this.visiblediv=document.getElementById(this.tickerid+"1") 
    this.hiddendiv=document.getElementById(this.tickerid+"2") 
    this.visibledivtop=parseInt(pausescroller.getCSSpadding(this.tickerdiv)) 
    //set width of inner DIVs to outer DIV's width minus padding (padding assumed to be top padding x 2) 
    this.visiblediv.style.width=this.hiddendiv.style.width=this.tickerdiv.offsetWidth-(this.visibledivtop*2)+"px" 
    this.getinline(this.visiblediv, this.hiddendiv) 
    this.hiddendiv.style.visibility="visible" 
    var scrollerinstance=this 
    document.getElementById(this.tickerid).onmouseover=function(){scrollerinstance.mouseoverBol=1} 
    document.getElementById(this.tickerid).onmouseout=function(){scrollerinstance.mouseoverBol=0} 
    if (window.attachEvent) //Clean up loose references in IE 
    window.attachEvent("onunload", function(){scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null}) 
    setTimeout(function(){scrollerinstance.animateup()}, this.delay) 
    } 


    // ------------------------------------------------------------------- 
    // animateup()- Move the two inner divs of the scroller up and in sync 
    // ------------------------------------------------------------------- 

    pausescroller.prototype.animateup=function(){ 
    var scrollerinstance=this 
    if (parseInt(this.hiddendiv.style.top)>(this.visibledivtop+5)){ 
    this.visiblediv.style.top=parseInt(this.visiblediv.style.top)-5+"px" 
    this.hiddendiv.style.top=parseInt(this.hiddendiv.style.top)-5+"px" 
    setTimeout(function(){scrollerinstance.animateup()}, 50) 
    } 
    else{ 
    this.getinline(this.hiddendiv, this.visiblediv) 
    this.swapdivs() 
    setTimeout(function(){scrollerinstance.setmessage()}, this.delay) 
    } 
    } 

    // ------------------------------------------------------------------- 
    // swapdivs()- Swap between which is the visible and which is the hidden div 
    // ------------------------------------------------------------------- 

    pausescroller.prototype.swapdivs=function(){ 
    var tempcontainer=this.visiblediv 
    this.visiblediv=this.hiddendiv 
    this.hiddendiv=tempcontainer 
    } 

    pausescroller.prototype.getinline=function(div1, div2){ 
    div1.style.top=this.visibledivtop+"px" 
    div2.style.top=Math.max(div1.parentNode.offsetHeight, div1.offsetHeight)+"px" 
    } 

    // ------------------------------------------------------------------- 
    // setmessage()- Populate the hidden div with the next message before it's visible 
    // ------------------------------------------------------------------- 

    pausescroller.prototype.setmessage=function(){ 
    var scrollerinstance=this 
    if (this.mouseoverBol==1) //if mouse is currently over scoller, do nothing (pause it) 
    setTimeout(function(){scrollerinstance.setmessage()}, 100) 
    else{ 
    var i=this.hiddendivpointer 
    var ceiling=this.content.length 
    this.hiddendivpointer=(i+1>ceiling-1)? 0 : i+1 
    this.hiddendiv.innerHTML=this.content[this.hiddendivpointer] 
    this.animateup() 
    } 
    } 

    pausescroller.getCSSpadding=function(tickerobj){ //get CSS padding value, if any 
    if (tickerobj.currentStyle) 
    return tickerobj.currentStyle["paddingTop"] 
    else if (window.getComputedStyle) //if DOM2 
    return window.getComputedStyle(tickerobj, "").getPropertyValue("padding-top") 
    else 
    return 0 
    } 

    </script> 

    </head> 

    <body>         

     <div id="squareBox"> 
      <p id="lastRun">Management Dashboard<span style="font-size: small;">&#169;&#8482; (v1.14)<Strong> <a href="../WebMon/WebMonitorHelp.html" target="_blank" >&#9730;</a></Strong></span><br/> 

      </p> 

      <div id="square1" class="squared"> 
       <span class="sqHeader"> 1 Monitor</span> 
       <table id="tb_1"> 
        <th>Response</th> 
        <th>Longest-Queued</th> 
        <th>Status</th> 
        <th>#</th> 
        <tbody id="data1"></tbody> 
       </table> 
      </div> 
      <div id="square2" class="squared"> 
       <span class="sqHeader">2 Monitor</span> 
       <table id="tb_2"> 
        <th>Response</th> 
        <th>Longest-Queued</th> 
        <th>Status</th> 
        <th>#</th> 
        <tbody id="data2"></tbody> 
       </table> 
      </div> 
      <div id="square3" class="squared"> 
       <span class="sqHeader">3 Monitor</span> 
       <table id="tb_3"> 
        <th>Type</th> 
        <th>Longest-Queued</th> 
        <th>Status</th> 
        <th>#</th> 

        <tbody id="data3"></tbody> 
       </table> 
      </div> 
      <div id="square4" class="squared"> 
       <span class="sqHeader" id="Kaiser">4 Monitor</span> 
       <table id="tb_4"> 
        <th>Type</th> 
        <th>UnTouched Ticket</th> 
        <th>Status</th> 
        <th>#</th> 
        <tbody id="data4"></tbody> 
       </table> 
      </div> 
      <div id="square5" class="squared"> 
       <span class="sqHeader">5 Monitor</span> 
       <table id="tb_5"> 
        <th>Minutes</th> 
        <th>Longest-Queued</th> 
        <th>Status</th> 
        <th>#</th> 
        <tbody id="data5"></tbody> 
       </table> 
      </div> 
      <div id="square6" class="squared"> 
       <span class="sqHeader">6 Monitor</span> 
       <table id="tb_6"> 
        <tbody id="pscroller1"></tbody> 
       </table> 
      </div> 
      <div id="square7" class="squared"> 
       <span class="sqHeader">7 Monitor</span> 
       <table id="tb_7"> 
        <th>Response</th> 
        <th>Longest-Queued</th> 
        <th>Status</th> 
        <th>#</th> 
        <tbody id="data7"></tbody> 
       </table> 
      </div> 
      <div id="square8" class="squared"> 
       <span class="sqHeader">8 Monitor</span> 
       <table id="tb_8"> 
        <th>Response</th> 
        <th>Longest-Queued</th> 
        <th>Status</th> 
        <th>#</th> 
        <tbody id="data8"></tbody> 
       </table> 
      </div> 
      <div id="square9" class="squared"> 
       <span class="sqHeader">9 Monitor</span> 
       <table id="tb_9"> 
        <th>Response</th> 
        <th>Longest-Queued</th> 
        <th>Status</th> 
        <th>#</th> 
        <tbody id="data9"></tbody> 
       </table> 
      </div> 
      <div id="square10" class="squared"> 
       <span class="sqHeader">#10 Monitor</span> 
       <table id="tb_10"> 
        <th>Response</th> 
        <th>Longest-Queued</th> 
        <th>Status</th> 
        <th>#</th> 
        <tbody id="data10"></tbody> 
       </table> 
      </div> 
      <div id="square11" class="squared"> 
       <span class="sqHeader">#11 Monitor</span> 
       <table id="tb_11"> 
        <th>Response</th> 
        <th>Longest-Queued</th> 
        <th>Status</th> 
        <th>#</th> 
        <tbody id="data11"></tbody> 
       </table> 
      </div> 
      <div id="square12" class="squared"> 
       <span class="sqHeader">#12 Monitor</span> 
       <table id="tb_12"> 
        <th>Response</th> 
        <th>Longest-Queued</th> 
        <th>Status</th> 
        <th>#</th> 
        <tbody id="data12"></tbody> 

       </table> 
      </div> 
     </div> 


    <script type="text/javascript"> 
     //new pausescroller(name_of_message_array, CSS_ID, CSS_classname, pause_in_miliseconds) 
     new pausescroller(pausecontent, "pscroller1", "someclass", 5000) 
     document.write("<br />") 
     //new pausescroller(pausecontent2, "pscroller2", "someclass", 2000) 


    </script> 

    </body> 
    </html> 
//CSS 
     body { 
     background: #d0e4fe; 
     font-family: 'HP Simplified', Arial, Verdana, Helvetica, Sans-serif; 
    } 
    p#lastRun{ 
     font-family: Garamond, 'Times New Roman', Georgia, serif; 
     font-variant: small-caps; 
     //font-weight: bold; 
     font-size:1.5em; 
     text-align:center; 
     background: black; 
     color: white; 
     } 

    h1 { 
     color: orange; 
     text-align: center; 
    } 
    a {color:#7FFFD4; 
    } 

    #mHeader, #mHeader2{ 
     text-align: center; 
     font: Georgia, Times, serif; 
     font-size: small; 
     //font-weight: bold; 
    } 

    /* squares configuration */ 

    #squareBox { 
     margin-left: auto; 
     margin-right: auto; 
     width: 1568px; 
     height: 700px; 
     //border: 2px solid #73AD21; 
     //border-radius: 10px; 
     //background: url(paper.gif); 
     background: tan; 
    } 
    .squared { 
     position: relative; 
     float: left; 
     background: WhiteSmoke; 
     width: 386px; 
     height: 203px; 
     outline-style: solid; 
     outline-width: 1px; 
     outline-color: green; 
     margin-left: 5px; 
     margin-top: 5px; 
     text-align: center; 

    } 
    #square1{ 
     margin-top: -18px; 
    } 
    #square2{ 
     margin-top: -18px; 
    } 
    #square3{ 
     margin-top: -18px; 
    } 
    #square4{ 
     margin-top: -18px; 
    } 
    #square5{ 

    } 
    #square6{ 

    } 
    #square7{ 

    } 
    #square8{ 

    } 
    #square9{ 

    } 
    #square10{ 
    } 
    #square11{ 
    } 
    #square12{ 

    } 
    .sqHeader{ 
     font-weight: bold; 
     font-variant: small-caps; 
     text-align: center; 
    } 

    /* Table configuration */ 

    th{ 
     font-size: small; 
     font-variant:small-caps; 
     background: Wheat; 
    } 
    table, td, th{ 
     margin: 1em; border-collapse: collapse; 
     border: 1px solid black; 
     padding: .15em; 
     margin-top: 2px; 
     font-size: 100%; 
     font-weight: bold; 
     margin-left: auto; 
     margin-right: auto; 
    } 
    td { 
     font-size:87%; 

    } 
    td #pscroller1 { 
     //font-size: 87%; 
    } 

    tbody tr:nth-child(even) { 
     background: #F8F8F8 ; 
    } 
    tbody tr:nth-child(odd) { 
     background: #99FFCC; 
    } 
    tbody tr:hover { 
     background: #c9f; 
    } 

    #dataContainter, #rightNavBar, #leftNavBar{ 
     height: 580px; 
     outline-style: solid; 
     outline-width: 1px; 
     outline-color: green; 
    } 
    #leftNavBar , #rightNavBar { 
     width: 146px; 
     background: light-gray; 
     font-size: 74%; 
    } 
    #leftNavBar { 
     float: left; 
    } 
    #rightNavBar { 
     float: right; 
    } 
    #filterButton{ 
     margin-left: auto; 
     margin-right: auto; 
    } 

    .statusGray { 
     background: gray; 
     } 

    .statusRed { 
     background: red; 
     color: white; 
     font-weight: bold; 
     text-decoration: blink; 
    } 
    .statusYellow{ 
     background: yellow; 
     color: black; 
     font-weight: bold; 
    } 
    .statusGreen{ 
     background: green; 
     color: white; 
     font-weight: bold; 
    } 
    .statusBlue{ 
     background: blue; 
     color: white; 
     font-weight: bold; 
    } 
    .regionRed { 
     background: #FF6600; 
    } 


    #displayResults tr:hover { 
     background: #FFFF00; 
    } 
    #customers tr.alt td { 
     color: #EAF2D3; 
     background: #000000; 
    }; 
    input:focus { 
     background: yellow; 
    } 
    button:hover { 
     background: blue; 
     color: white 

    } 
    .dEntry:focus, .qSearch:focus { 
     background: #99FFFF; 
    } 
    .dEntry, .data { 
     font-family: 'HP Simplified', Arial, Verdana, Helvetica, Sans-serif; 
     //font-weight: bold; 
     //font-size: 80%; 
     //color: blue; 
    } 
    /***************************************************** 
    * generic styling for ALS elements: outer container 
    ******************************************************/ 

    /*Example CSS for the two demo scrollers*/ 

    div#pscroller1 { 
     position: absolute; 
     width: 340px; 
     height: 160px; 
     bottom: 405px; 
     padding: 5px; 
     left: 465px; 
     //border: 1px solid black; 
    } 


    #pscroller2{ 
    width: 700px; 
    height: 20px; 
    border: 1px solid black; 
    padding: 3px; 

    } 

    #pscroller1 li, #pscroller1 a{ 
     text-decoration: none; 
     font-size: 89%; 
     font-variant:small-caps; 
     font-weight: bold; 
     color: black; 
    } 


    .someclass{ //class to apply to your scroller(s) if desired 
    } 
+1

http://stackoverflow.com/help/mcve – j08691

ответ

0

Я предполагал, на "прокручивать содержание" вы имеете в виду автоматического перемещения по экрану. Как насчет использования библиотеки marquee?

Вот скрипку я собрал на сетке: https://jsfiddle.net/7gz5x1mk/1/ с помощью JQuery шатра плагин http://aamirafridi.com/jquery/jquery-marquee-plugin#examples

HTML

<div id="square6" class="squared" style="border: 1px solid red;"> 
     <span class="sqHeader">6 Monitor</span> 
     <div class="marquee">jQuery marquee is the best <b>marquee</b> plugin in the world</div> 
    </div> 

HTML для вертикального скроллинга

<div class="marquee ver" data-direction='up' data-duration='1000' data-pauseOnHover="true"> 
     jQuery marquee is the best marquee plugin in the world. jQuery marquee is the best marquee plugin in the world <b>end</b> 
    </div> 

Javascript

$('.marquee').marquee(); 

CSS

.marquee { 
    width: 300px; 
    overflow: hidden; 
    border: 1px solid #ccc; 
    background: #ccc; 
} 
+0

Спасибо за быстрый ответ, мне нужно содержание для прокрутки вверх по вертикали – Dewinky

+0

Примерно на полпути вниз по ссылке примера я Приведенную выше есть раздел «Направление». См. Обновление скрипки на https://jsfiddle.net/7gz5x1mk/2/ – biggles

+0

Снова спасибо за ваши усилия, я наконец-то увидел вариант «направление:». Я заметил, что сдвинутые квадраты 8-12 выровнены. Есть идеи? Хотел бы я все понять. – Dewinky

Смежные вопросы