Skip to content

Instantly share code, notes, and snippets.

@russom-woldezghi
Last active December 12, 2015 02:28
Show Gist options
  • Save russom-woldezghi/4699329 to your computer and use it in GitHub Desktop.
Save russom-woldezghi/4699329 to your computer and use it in GitHub Desktop.
jQuery slider
<!DOCTYPE html>
<html>
<head>
<title>jQuery Slider</title>
<!-- jQuery -->
<script src="http://code.jquery.com/jquery-1.5.js"></script>
<script type="text/javascript" src="slider.js"></script>
<!--CSS -->
<link href="style.css" rel="stylesheet" media="screen">
</head>
<body>
<class id="showr">Legend</class>
<div>
<class id="legend-contents">
<class id="factor">
<h1>Legend</h1>
Factor 1: Tempor ut turpis sed adipiscing lectus rhoncus</class>
<class
id="factor">Factor 2: Tempor ut turpis sed adipiscing lectus rhoncus</class>
</class>
<class id="hidr">
<p>(Hide)</p>
</class>
</div>
</body>
</html>
$("#showr").click(function () {
$("div").slideToggle(function () {
/* use callee so don't have to name the function */
$("#showr").hide();
$("div").show();
});
});
$("#hidr").click(function () {
$("div").hide();
$("#showr").show();
});
div {
background: #449773;
padding:5px;
width:310px;
height:280px;
display:none;
float:left;
text-align:left;
font-family:Arial;
font-size:.7em;
}
div p {
color:#fff;
padding: 5px 10px;
float:right;
}
#showr {
font-family:Arial;
font-size: .7em;
font-weight:700;
color:#5C555C;
}
#factor {
color:#fff;
padding-bottom:5px;
clear:both;
}
#factor h1 {
font-size:1.3em;
padding-bottom: 5px;
}
#hidr {
position:relative;
top:250px;
right:5px;
}
#hidr:hover {
font-weight:700;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment