问答详情
源自:2-3 导航页面切换(3)

transform: translateY(-300%); 无效

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>

<!doctype html>

<html>

<head>

<meta charset="gb2312">

<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">

<title>无标题文档</title>

<link href="icgay.css" rel="stylesheet" type="text/css">

</head>


<body>

<div class="box">

  <div class="st-box"> 

    <!-- nav begin-->

    <input type="radio" name="radio-set" id="st-control-1" checked="checked">

    <a href="#st-panel-1">one</a>

    <input type="radio" name="radio-set" id="st-control-2">

    <a href="#st-panel-2">two</a>

    <input type="radio" name="radio-set" id="st-control-3">

    <a href="#st-panel-3">three</a>

    <input type="radio" name="radio-set" id="st-control-4">

    <a href="#st-panel-4">four</a>

    <input type="radio" name="radio-set" id="st-control-5">

    <a href="#st-panel-5">five</a> 

    <!-- nav end content brgin-->

    <div class="st-scroll">

      <section class="st-panel" id="st-panel-1">

        <div class="st-desc">1</div>

        <h3>a</h3>

      </section>

      <section class="st-panel" id="st-panel-2">

        <div class="st-desc">2</div>

        <h3>b</h3>

      </section>

      <section class="st-panel" id="st-panel-3">

        <div class="st-desc">3</div>

        <h3>c</h3>

      </section>

      <section class="st-panel" id="st-panel-4">

        <div class="st-desc">4</div>

        <h3>d</h3>

      </section>

      <section class="st-panel" id="st-panel-5">

        <div class="st-desc">5</div>

        <h3>e</h3>

      </section>

    </div>

  </div>

</div>

</body>

</html>


下面是css

@charset "gb2312";

body {

font-family: "宋体";

font-size: 15px;

font-weight: bold;

color: #06F;

background-color: #ddd;

overflow: hidden;

margin: 0px;

padding: 0px;

}

.clr {

width: 0;

height: 0;

clear: both;

overflow: hidden;

}

.st-box {

width: 100%;

height: 100%;

position: absolute;

left: 0;

top: 0;

}

.st-box > input, .st-box > a {

width: 20%;

height: 35px;

line-height: 35px;

position: fixed;

bottom: 0;

font-weight: 400;

font-size: 18px;

cursor: pointer;

text-decoration: none;

}

.st-box > input {

opacity: 0;

z-index: 1000;

}

.st-box > a {

z-index: 100;

font-size: 20px;

background: #09F;

color: #FFF;

text-align: center;

box-shadow: 1px 1px 3px rgba(0,0,0,0.8);

text-shadow: 1px 1px 3px rgba(0,0,0,0.8);

font-weight: bold;

}

#st-control-1, #st-control-1 + a {

left: 0%;

}

#st-control-2, #st-control-2 + a {

left: 20%;

}

#st-control-3, #st-control-3 + a {

left: 40%;

}

#st-control-4, #st-control-4 + a {

left: 60%;

}

#st-control-5, #st-control-5 + a {

left: 80%;

}

.st-box input:checked + a, .st-box input:checked:hover + a {

background-color: #03F;

}

.st-box input:checked + a:after {

content: "";

width: 0px;

height: 0px;

overflow: hidden;

position: absolute;

bottom: 100%;

border: 20px solid transparent;

border-bottom-color: #03F;

left: 50%;

margin-left: -20px;

}

.st-box input:hover + a {

background-color: #0CF;

}

.st-scroll, .st-panel {

height: 100%;

width: 100%;

position: relative;

}

.st-scroll {

position: relative;

left: 0px;

top: 0px;

-webkit-transform: translate3d(0, 0, 0);

-moz-transform: translate3d(0, 0, 0);

-ms-transform: translate3d(0, 0, 0);

-o-transform: translate3d(0, 0, 0);

transform: translate3d(0, 0, 0);

-webkit-backface-visibility: hidden;

}

.st-panel {

background-color: #FFF;

overflow: hidden;

}

#st-control-5:checked ~ .st-scroll {

-webkit-transform: translateY(-100%);

-moz-transform: translateY(-100%);

-o-transform: translateY(-100%);

-ms-transform: translateY(-100%);

transform: translateY(-100%);

}

这里没贴完 

前两个radio 没问题  后面3个 就不行  transform: translateY(-100%);   小于-200 时候 就无效了 如果改成0或者-100 都没问题 但是-300 -200 就无效 自动 变成 原始0

提问者:kakateemo 2015-06-17 09:49

个回答

  • only_ontheway
    2015-07-04 11:15:25

    是不是选择器名称没对