2
I know the question is confusing, but here’s the thing, I made a jQuery code by codeacademy (jQuery Functions and Selectors 11.Click and Pull), and there it teaches you how to make an algorithm that I thought was really cool, but it only works there, in my browser does not work, either in firefox or in Chrome. He’s like that:
And then when you click on Slide Up/Down it should look like this:
However, in the browser it when I click nothing happens. It is just like this in the first image.
$(document).ready(function(){
$('.pull-me').click(function(){
$('.panel').slideToggle('slow');
});
});
body {
margin:0 auto;
padding:0;
width:200px;
text-align:center;
}
.pull-me{
-webkit-box-shadow: 0 0 8px #FFD700;
-moz-box-shadow: 0 0 8px #FFD700;
box-shadow: 0 0 8px #FFD700;
cursor:pointer;
}
.panel {
background: #ffffbd;
background-size:90% 90%;
height:300px;
display:none;
font-family:garamond,times-new-roman,serif;
}
.panel p{
text-align:center;
}
.slide {
margin:0;
padding:0;
border-top:solid 2px #cc0000;
}
.pull-me {
display:block;
position:relative;
right:-25px;
width:150px;
height:20px;
font-family:arial,sans-serif;
font-size:14px;
color:#ffffff;
background:#cc0000;
text-decoration:none;
-moz-border-bottom-left-radius:5px;
-moz-border-bottom-right-radius:5px;
border-bottom-left-radius:5px;
border-bottom-right-radius:5px;
}
.pull-me p {
text-align:center;
}
<!DOCTYPE html>
<html>
<head>
<title>Slide Panel</title>
<script type="text/javascript" src="Slide.js"></script>
<link rel="stylesheet" type="text/css" href="Slide.css"></link>
</head>
<body>
<div class="panel">
<br />
<br />
<p>Now you see me!</p>
</div>
<p class="slide"><div class="pull-me">Slide Up/Down</div></p>
</body>
</html>
The three files are in the same folder and are named as Slide.html, Slide.css and Slide.js; Since both html and css were already done, I just did javascript. I don’t know if it’s some configuration or something that has to be installed, but I don’t think it’s anything like that.
If you could help me and explain what’s wrong I’d really appreciate it.
Thank you.
Very interesting, always good to learn new forms and ideas.
– Alan Rezende
@Alanrezende I find it cool to complement with alternatives, so there are various possibilities for future visitors. So we already have yours, which solves the author’s code, an alternative with CSS and perhaps someone else post alternatives. These sliders serve for a lot of things.
– Bacco