【问题标题】:My working Div is not getting resized to mobile device我的工作 Div 没有调整到移动设备的大小
【发布时间】:2014-02-21 09:24:31
【问题描述】:

我使用Quick flip 2 创建了一个应用程序。我希望这个应用程序能够调整到移动屏幕的大小。为此,我使用了jquery-mobile

这是我所做的:

<!--css-->


<style>


.quickFlip, .quickFlip3 {
    height: 350px;
    width: 400px;
}

.quickFlip2 {
   height: 150px;
    width: 40%;
    float: left;
    margin-right: 9%;
}

/* the rest of this is irrelevent */

.clear {
    clear: both;
    magin: 0;
    padding: 0;
}

.redPanel, .blackPanel {
    text-align: center;
}

.half-col {
    width: 50%;
    float: left;
}

/**** panels ****/

.quickFlip, .quickFlip2, .quickFlip3 {
    font-family: "Trebuchet MS", Verdana, Sans-serif, sans;
    font-size: 13px;
    position: relative;
}

.quickFlip .blackPanel, .quickFlip2 .blackPanel, .quickFlip3 .blackPanel {
    background-color: #FFD993;
    color: darkbrown;
    border: 1px outset #A61C14;
    -moz-border-radius: 8px;
    -webkit-border-radius: 8px;
}

.quickFlip .redPanel, .quickFlip2 .redPanel, .quickFlip3 .redPanel {
    background-color: #75941f;
    color: #FFF;
    border: 1px outset #4f6417;
    -moz-border-radius: 8px;
    -webkit-border-radius: 8px;
}

.half-col p {
    padding: 5px;
    margin:0 30px 10px 30px;
}

.half-col p.panel-content {
    text-align: left;
    margin-top: 10px;
}

.half-col h3, .half-col h4 {
    padding: 0;
    margin: 0 35px;
}

.half-col h3 {
    text-align: left;
    font-size:24px;
    line-height:24px;
}

.half-col .redPanel h3 {
    text-align: center;
    margin-bottom: 10px;
}

.half-col .first {
    margin-top: 30px;
}

.half-col EM {
    display: block;
    padding: 0;
}

.half-col A.quickFlipCta {
    position: absolute;
    bottom: 30px;
    left: 65px;
    width: 210px;
    font-size: 15px;
    outline: none;
}

.quickFlip2 .redPanel a {
    color: #FFF;
}

.quickFlipCta {
    cursor: pointer;
}
</style>
<!--Javascript-->
<script src="jquery-1.9.1.js"></script>
<script src="jquery.mobile-1.4.1.js"></script>
<script src="jquery.quickflip.source.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
    $('.quickFlip').quickFlip();

    $('.quickFlip3').quickFlip({
        vertical : true
    });

    $('.quickFlip2').quickFlip();
});
</script>

<script>

$(document).ready(function() {
//alert("1");
function getImage(){
    var img = new Image();
    img.src = "apple_transparent.gif"
    img.width = 80;
    img.height=80;

    return img;
}
var rand = Math.floor(Math.random() * 10) + 1,
    imgContainer = $("#imgContainer"),
    i;
//alert(rand);
$("#imgNo").text(rand);

for (i=0; i<rand; i++){
    imgContainer.append(getImage());
}
$('#shownext').click(function(){

   location.reload();
        });
$("#click_flip").click(function(){
//alert("numbers/"+rand+".png");
$("#theImg").remove();
 $('#b').append('<img id="theImg" src="numbers/' + rand + '.png" width="260px" height="260px"/>');

});
});
</script>
</head>
<body>

<div data-role="page">


  <div data-role="main" class="ui-content">
     <div class="quickFlip">
        <div id="imgContainer" class="blackPanel">

            <center><input id="click_flip" type="button" class="quickFlipCta" value="Flip to see the Answer" ></center>




        </div>

        <div id="b" class="redPanel">

            <!-- <h4>A plugin for jQuery</h4>
            <p><em>By Jon Raasch</em></p> -->
                   <center> <input id="flip_again" class="first quickFlipCta" type="button" value="Flip Again" ></center>
                  <center> <input id="shownext" type="button" value="Show Next" ></center>
        </div>
    </div>

  </div>

  </div> 

但这不起作用。我应该做些什么改变才能让它发挥作用?

页面 div 正在调整大小,但我的具有 QuickFlip 类的 div(我的工作 div)没有调整大小

【问题讨论】:

    标签: android jquery css jquery-mobile flip


    【解决方案1】:
    .cendiv{
      background: #e5e5e5;
      bottom: 0;
      height: 80%;
      left: 0;
      margin: auto;
      position: absolute;
      top: 0;
      right: 0;
      width: 98%;
    }
    

    【讨论】:

    • 我不明白我必须做什么。我应该在哪个 div 中添加此类 cendiv?
    • 首先你必须添加这个......然后在主div中调用cendiv类你用过的
    • 从主 div 调用这个类后,是的 div 变小了,但没有使用 quickflip 类调整内部 div 的大小。
    • 你必须使用 % 而不是像素
    • 也使用了 % 但不起作用。同样的结果。页面 div 越来越小,但 Quickflip div 没有调整大小
    猜你喜欢
    • 2019-08-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多