右侧幻灯片HTML

时间:2014-03-27 07:16:55

标签: jquery panel sliding

我正在尝试实现滑动面板,我使用了来自http://www.dzyngiri.com/sliding-panel-menu-using-jquery/#comment-16912的脚本,但是我无法让任何人帮忙吗?我已粘贴下面的完整HTML

   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- saved from url=(0055)http://arungudelli.webuda.com/Slidepanel/sidepane.html# -->
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>Slide Panel Demo</title>

<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>



<script type="text/javascript">
    $(document).ready(function() {
    $("#studentdetails").height($(document).height());
    });
</script>
<script type="text/javascript">
$(document).ready(function() {
setTimeout( function(){$('#studentdetails').css('right','-321px');},4000); <!-- Change 'left' to 'right' for panel to appear to the right -->
});
</script>


<style type="text/css">
    #studentdetails {
        background: #9cb925;
        border-right: 3px solid #ee4e1d;
        width: 100px;
        padding: 30px;
        position: fixed;
        z-index: 100000;

        box-shadow: 4px 0 10px rgba(0,0,0,0.25);
        -moz-box-shadow: 4px 0 10px rgba(0,0,0,0.25);
        -webkit-box-shadow: 4px 0 10px rgba(0,0,0,0.25);
    }

    #studentdetails {
        right: 0; /* Change to right: 0; if you want the panel to display on the right side. */
    }

    #studentdetails:hover, #menu:focus {
        right: 0 !important; /* Change to right: 0 !important; if you want the panel to display on the right side. */
    }

    #studentdetails .arrow {
        left: 2px; /* Change to left: 2px; if you want the panel to display on the right side. */
    }

    #studentdetails .arrow {
        font: normal 400 25px/25px 'Acme', Helvetica, Arial, sans-serif; /* Acme font is required for .arrow */
        color: rgba(0,0,0,0.75); /* Arrow color */
        width: 16px;
        height: 25px;
        display: block;
        position: absolute;
        top: 20px;
        cursor: default;
    }

    #studentdetails:hover .arrow {
        transform: rotate(-180deg) translate(6px,-3px);
        -moz-transform: rotate(-180deg) translate(6px,-3px);
        -webkit-transform: rotate(-180deg) translate(6px,-3px);
    }

    #studentdetails nav {
        position: relative;
        top: 75px;
    }

    #studentdetails nav a {
        padding: 10px 5px;
        border-bottom: 1px dotted #c0c0c0;
        display: block;
        clear: both;
        font: bold 13px/18px 'Open Sans', Helvetica, Arial, sans-serif;
        color: #fff;
        text-decoration: none;
    }

    #studentdetails nav a:hover {
        color: #ee4e1d;
    }

</style>
</head>

<body>
    <div id="studentdetails">
                    <div class="arrow"></div>
                    <nav>
                        <div id="studentinfo">
                            <ul>
                                <li><h4>Student Details:</h4></li>
                                <li>Student Name: <label>Ahamed</label></li>
                                <li>Class: <label>5</label></li>
                                <li>Age: <label>14</label></li>
                                <li>Parent Name: <label>Mohammed</label></li>
                                <li>Contact No.: <label>+97150505050</label></li>
                            </ul>
                        </div>
                        <div id="studenttravel-stats">
                            <h4>Student Status:</h4>
                            <table id="travel-statsTable">
                                <tr>
                                    <td><img src="img/HomeIcon_green.png"></td>
                                    <td><label>Al Barsha <br>07:00AM<br></label></td>
                                    <td><img src="img/arrow_right.png"></td>
                                    <td><img src="img/SchoolIcon_red.png"></td>
                                    <td><label>Jebel Ali <br>08:00AM<br></label></td>
                                </tr>
                                <tr>
                                    <td><img src="img/SchoolIcon_green.png"></td>
                                    <td><label>Jebel Ali <br>04:00AM<br></label></td>
                                    <td><img src="img/arrow_right.png"></td>
                                    <td><img src="img/HomeIcon_red.png"></td>
                                    <td><label>Al Barsha <br>05:00AM<br></label></td>
                                </tr>
                            </table>
                        </div>
                        <div id="studentattendance-check">
                            <label>Check Attendance:</label>
                            <a href="#"><label>7days</label></a>
                            <a href="#"><label>14days</label></a>
                            <a href="#"><label>30days</label></a>
                        </div>
                    </nav>
                </div>
</body>
</html>

1 个答案:

答案 0 :(得分:0)

我选择了原始示例并将其添加到您的菜单中。见下面的完整代码。在CSS中我有:

  • #menu重命名为#studentdetails
  • 删除了我从HTML
  • 中删除的网页部分的CCS规则
  • 并添加了以下三条规则:#studentdetails#studentdetails:hover, #studentdetails:focus#studentdetails.arrow

我希望它适合你。

<!DOCTYPE html>
<html>
<head>
<!-----META----->
<title>Sliding menu panel using jQuery</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
    <meta name="description" content="Sliding menu panel using jQuery" />
    <meta name="keywords" content="menu, sliding menu, tutorial, jQuery, css, html" />
    <meta name="author" content="Dzyngiri" />

<!-----STYLESHEETS----->
<style>
@import url(http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400italic,600,600italic,700italic,700,300italic,300|Acme); /* Acme font is required for .arrow */

::selection {
    color: #fff;
    background: #ec6912;
}

::-moz-selection {
    color: #fff;
    background: #ec6912;
}

* {
    margin: 0;
    padding: 0;
    border: none;
}

body {
    background: url(retina_dust.png) repeat #d3d7dc;
    font: normal 400 14px/21px 'Source Sans Pro', Helvetica, Arial, sans-serif;
    color: #464851;
}

h1 {
    font: normal 48px/56px 'BebasNeueRegular', Helvetica, Arial, sans-serif;
    color:#ee4e1d;
    text-shadow: 1px 1px 0 #f2f2e5, 1px 2px 0 #aaa;
    margin-bottom: 30px;
}

p {
    text-shadow: 1px 1px 0 rgba(255,255,255,0.75);
    margin-bottom: 20px;
}

strong {
    font-weight: 700;
}

#studentdetails, #studentdetails .arrow, #studentdetails nav a {
    transition: all 0.4s;
    -o-transition: all 0.4s;
    -moz-transition: all 0.4s;
    -webkit-transition: all 0.4s;
}

#studentdetails {
    background: #9cb925;
    border-right: 3px solid #ee4e1d;
    width: 100px;
    padding: 30px;
    position: fixed;
    z-index: 100000;

    box-shadow: 4px 0 10px rgba(0,0,0,0.25);
    -moz-box-shadow: 4px 0 10px rgba(0,0,0,0.25);
    -webkit-box-shadow: 4px 0 10px rgba(0,0,0,0.25);
}

#studentdetails {
    right: 0; /* Change to right: 0; if you want the panel to display on the right side. */
}

#studentdetails:hover, #studentdetails:focus {
    right: 0 !important; /* Change to right: 0 !important; if you want the panel to display on the right side. */
}

#studentdetails .arrow {
    left: 13px; /* Change to left: 2px; if you want the panel to display on the right side. */
}

#studentdetails .arrow {
    font: normal 400 25px/25px 'Acme', Helvetica, Arial, sans-serif; /* Acme font is required for .arrow */
    color: rgba(0,0,0,0.75); /* Arrow color */
    width: 16px;
    height: 25px;
    display: block;
    position: absolute;
    top: 20px;
    cursor: default;
}

#studentdetails:hover .arrow {
    transform: rotate(-180deg) translate(6px,-3px);
    -moz-transform: rotate(-180deg) translate(6px,-3px);
    -webkit-transform: rotate(-180deg) translate(6px,-3px);
}

#studentdetails nav {
    position: relative;
    top: 75px;
}

#studentdetails nav a {
    padding: 10px 5px;
    border-bottom: 1px dotted #c0c0c0;
    display: block;
    clear: both;
    font: bold 13px/18px 'Open Sans', Helvetica, Arial, sans-serif;
    color: #fff;
    text-decoration: none;
}

#studentdetails nav a:hover {
    color: #ee4e1d;
}
</style>

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

<script type="text/javascript">
$(document).ready(function() {
    $("#studentdetails").height($(document).height());
    setTimeout( function(){$('#studentdetails').css('right', '-130px');},3000); <!-- Change 'left' to 'right' for panel to appear to the right -->
});
</script>

</head>

<body>

<!-----SLIDING MENU PANEL----->
    <div id="studentdetails">
        <div class="arrow"><</div>
        <nav>
            <div id="studentinfo">
                <ul>
                    <li><h4>Student Details:</h4></li>
                    <li>Student Name: <label>Ahamed</label></li>
                    <li>Class: <label>5</label></li>
                    <li>Age: <label>14</label></li>
                    <li>Parent Name: <label>Mohammed</label></li>
                    <li>Contact No.: <label>+97150505050</label></li>
                </ul>
            </div>
            <div id="studenttravel-stats">
                <h4>Student Status:</h4>
                <table id="travel-statsTable">
                    <tr>
                        <td><img src="img/HomeIcon_green.png"></td>
                        <td><label>Al Barsha <br>07:00AM<br></label></td>
                        <td><img src="img/arrow_right.png"></td>
                        <td><img src="img/SchoolIcon_red.png"></td>
                        <td><label>Jebel Ali <br>08:00AM<br></label></td>
                    </tr>
                    <tr>
                        <td><img src="img/SchoolIcon_green.png"></td>
                        <td><label>Jebel Ali <br>04:00AM<br></label></td>
                        <td><img src="img/arrow_right.png"></td>
                        <td><img src="img/HomeIcon_red.png"></td>
                        <td><label>Al Barsha <br>05:00AM<br></label></td>
                    </tr>
                </table>
            </div>
            <div id="studentattendance-check">
                <label>Check Attendance:</label>
                <a href="#"><label>7days</label></a>
                <a href="#"><label>14days</label></a>
                <a href="#"><label>30days</label></a>
            </div>
        </nav>
    </div>
<!-----END SLIDING MENU PANEL----->
</body>
</html>