Question

I am trying to implement the sliding panel and I have used the script from http://www.dzyngiri.com/sliding-panel-menu-using-jquery/#comment-16912 but I am unable to get it working can any one help? I have pasted the complete HTML below

   <!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>
Was it helpful?

Solution

I have picked the original example and addapted it to your menu. See below full code. In the CSS I have:

  • renamed #menu to #studentdetails,
  • removed the CCS rules for the page sections I removed from the HTML
  • and addapted these three rules: #studentdetails, #studentdetails:hover, #studentdetails:focus and #studentdetails.arrow.

I hope it works for you.

<!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>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top