Onclick显示/隐藏div& IMG

时间:2015-10-23 04:19:18

标签: javascript jquery html css

我想做什么。

我想尝试**> 箭头onclick SHOW侧边栏**。

点击它还会隐藏>箭头。

显示侧栏DIV后 - 显示**< 箭头。**

点击;隐藏<并隐藏DIV。

然后

激活手机时 -

将箭头移至顶部&旋转90度显示^和v显示/隐藏div栏..

<div style="display:none" id="sbar" class="sbar">
        <div class='arrowhide' style="display:sbarhide" id="toggleoff"> <a href="#" onclick="sbarhide('sbar')"><img id='arrow'src='http://img3.wikia.nocookie.net/__cb20141216054306/crusader-quest-th/images/d/d8/Left-arrow-right-hi.png' height="65" width="35"></img>
     </div>  
    <nav class="sidebar"> <a class="Logo" href="#">
      <span class="icons act fsize"></span>
    </a>
 <div class="links">
            <ul class="nav of aox">
                <li> <a href="#" title="Home" data-toggle="tooltip" data-placement="right" data-container="body">
            <span class="icons abw"></span>
            <small class="linkfsize sa">Home</small>
          </a>

                </li>
                <li> <a href="#" title="List" data-toggle="tooltip" data-placement="right" data-container="body">
            <span class="icons aie"></span>
            <small class="linkfsize sa">List</small>
          </a>
                </li>
                <li> <a href="#" title="Map" data-toggle="tooltip" data-placement="right" data-container="body">
            <span class="icons abh"></span>
            <small class="linkfsize sa">Map</small>
          </a>
                </li>
                <li class="active"> <a href="#" title="Stats" data-toggle="tooltip" data-placement="right" data-container="body">
            <span class="icons vd"></span>
            <small class="linkfsize sa">Stats</small>
          </a>
                </li>
                <li> <a href="#" title="Docs" data-toggle="tooltip" data-placement="right" data-container="body">
            <span class="icons ade"></span>
            <small class="linkfsize sa">Docs</small>
          </a>
                </li>
                <li> <a href="#" title="Logout" data-toggle="tooltip" data-placement="right" data-container="body">
            <span class="icons adk"></span>
            <small class="linkfsize sa">Logout</small>
          </a>
                </li>
                <li> <a href="#" title="Signed in as User First & Last Name" data-toggle="tooltip" data-placement="right" data-container="body">
            <img src="http://bootstrap-themes.github.io/dashboard/assets/img/avatar-mdo.png" alt="" class="cs cn">
            <small class="linkfsize sa">@mdo</small>
          </a>

                </li>
            </ul>
        </div>
    </nav>
</div>
<div class='arrowshow' style="display:sbarshow" id="toggleon">  <a href="#" onclick="sbarshow('sbar')"><img id='arrow'src='http://img3.wikia.nocookie.net/__cb20141216054306/crusader-quest-th/images/d/d8/Left-arrow-right-hi.png' height="65" width="35"></img>
     </div>    

<script>
function sbarshow(target) {
    document.getElementById(target).style.display = 'block';
}

function sbarhide(target) {
    document.getElementById(target).style.display = 'none';
}
        </script>

CSS

.arrowshow {
    padding-left: 2.5%;
    opacity: 0.1;
    position: absolute;
    top: 50%;
    z-index: -1;
}
.arrowhide {

    opacity: 0.5;
    position: absolute;
    top: 50%;
    z-index: 2;    
    -webkit-transform: rotate(180deg);     /* Chrome and other webkit browsers */
    -moz-transform: rotate(180deg);        /* FF */
    -o-transform: rotate(180deg);          /* Opera */
    -ms-transform: rotate(180deg);         /* IE9 */
    transform: rotate(180deg);             /* W3C compliant browsers */
}
/* SIDEBAR */
 .sidebar {
    margin-top: -20px;
    margin-bottom: 30px;
    white-space: nowrap;
}
@media (min-width: 768px) {
    .sidebar {
        overflow: hidden position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: 70px;
        margin-top: 0;
        margin-bottom: 0;
        background-color: #30343e;
        overflow-y: auto;
        -webkit-transform: translate3d(0, 0, 0);
    }
}
@media (min-width: 768px) {
    .sbar {
        padding-left: 85px;
        z-index: 1;
    }
}
@media (max-width: 768px) {
    .links {
        overflow: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }
}
/* SIDEBAR END */

/* LOGO Section */
 .Logo {
    display: block;
    padding-top: 30px;
    padding-bottom: 10px;
    font-size: 18px;
    line-height: 1;
    color: #6f7890;
    text-align: center;
    border-bottom: 0;
    background-color: #0f1013;
}
@media (min-width: 768px) {
    .Logo {
        padding-top: 20px;
        padding-bottom: 20px;
    }
}
.Logo:hover {
    color: #cfd2da;
    text-decoration: none;
}
/* pinAPP Logo Section END */

/* Sidebar FONT SIZE */
 .fsize {
    font-size: 30px;
}
.linkfsize {
    font-size: 14px;
}
/* Sidebar FONT Size END */

/* Sidebar ICONS */
 .icons:before {
    position: relative;
    top: 2px;
    display: inline-block;
    font-family:"toolkit-entypo";
    speak: none;
    font-size: 100%;
    font-style: normal;
    font-weight: normal;
    font-variant: normal;
    text-transform: none;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
/* Sidebar ICONS END */

在这里访问这些信息,看看我在谈论什么。

http://jsfiddle.net/LZoesch/1x809wbf/

@levizoesch 由于我的编辑在未经您许可的情况下更改了您的帖子,我将其添加为更新,因此如果这是您要求的更新您的帖子,请删除此部分。

更新:

我有一个侧边栏,默认情况下是隐藏的。我有一个右箭头。当用户点击它时,会显示侧栏,并显示左箭头,用于隐藏同一侧栏。箭头现在位于屏幕的中间(垂直)。

现在,当我在移动设备中打开此功能时,我希望将这些箭头移动到屏幕顶部,并且应该像上下箭头一样可见,而不是左右箭头。怎么做?

0 个答案:

没有答案