Note that there are some explanatory texts on larger screens.

plurals
  1. POJQuery Slider Implementation Issues
    primarykey
    data
    text
    <p>I've been trying to implement in slider in JQuery. I'm stuck up in one place. Here is my code so far.</p> <pre><code> &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Experimentation&lt;/title&gt; &lt;style type="text/css"&gt; #container { overflow:hidden; height: 200px; margin: 0 auto; width: 800px; background-color: white; } .box1, .box2, .box3, .box4, .box5 { width: 200px; height: 200px; background-color: gray; z-index: 10000; position: relative; float: left; overflow:hidden; } .information1, .information2, .information3, .information4, .information5 { position: absolute; width: 200px; height:200px; background-color: black; opacity: 0.2; top: 150px; color: #FFF; } .information1 h3, .information2 h3,.information3 h3, .information4 h3, .information5 h3 { margin: 3px 3px; text-align: center; } .leftbutton img { cursor:pointer; } .rightbutton img { cursor:pointer; } &lt;/style&gt; &lt;script type="text/javascript" src="jquery-1.4.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; var topInitial = "0"; var topAfter = "150px"; $(function() { $(".box1").mouseenter(function() { $(".information1").animate({ top: topInitial }, "normal"); }); $(".box1").mouseleave(function() { $(".information1").animate({ top: topAfter }, "normal"); }); $(".box2").mouseenter(function() { $(".information2").animate({ top: topInitial }, "normal"); }); $(".box2").mouseleave(function() { $(".information2").animate({ top: topAfter }, "normal"); }); $(".box3").mouseenter(function() { $(".information3").animate({ top: topInitial }, "normal"); }); $(".box3").mouseleave(function() { $(".information3").animate({ top: topAfter }, "normal"); }); $(".box4").mouseenter(function() { $(".information4").animate({ top: topInitial }, "normal"); }); $(".box4").mouseleave(function() { $(".information4").animate({ top: topAfter }, "normal"); }); $(".box5").mouseenter(function() { $(".information5").animate({ top: topInitial }, "normal"); }); $(".box5").mouseleave(function() { $(".information5").animate({ top: topAfter }, "normal"); }); $(".leftbutton img").click(function() { $(".box1").animate({ marginLeft: "-=200px" }, "fast"); }); $(".rightbutton img").click(function() { $(".box1").animate({ marginLeft: "+=200px" }, "fast"); }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="leftbutton"&gt;&lt;img src="left.gif"/&gt;&lt;/div&gt; &lt;div id="container"&gt; &lt;span class="box1"&gt; &lt;div class="information1"&gt; &lt;h3&gt; Criminal Penguins Having a Ball &lt;/h3&gt; &lt;p&gt; You have never seen something like this before!&lt;/p&gt; &lt;/div&gt; &lt;/span&gt; &lt;span class="box2"&gt; &lt;div class="information2"&gt; &lt;h3&gt; Criminal Penguins Having a Ball &lt;/h3&gt; &lt;p&gt; You have never seen something like this before!&lt;/p&gt; &lt;/div&gt; &lt;/span&gt; &lt;span class="box3"&gt; &lt;div class="information3"&gt; &lt;h3&gt; Criminal Penguins Having a Ball &lt;/h3&gt; &lt;p&gt; You have never seen something like this before!&lt;/p&gt; &lt;/div&gt; &lt;/span&gt; &lt;span class="box4"&gt; &lt;div class="information4"&gt; &lt;h3&gt; Criminal Penguins Having a Ball &lt;/h3&gt; &lt;p&gt; You have never seen something like this before!&lt;/p&gt; &lt;/div&gt; &lt;/span&gt; &lt;span class="box5"&gt; &lt;div class="information5"&gt; &lt;h3&gt; Criminal Penguins Having a Ball &lt;/h3&gt; &lt;p&gt; You have never seen something like this before!&lt;/p&gt; &lt;/div&gt; &lt;/span&gt; &lt;/div&gt; &lt;span class="rightbutton"&gt;&lt;img src="right.gif"/&gt;&lt;/span&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Removing the comments from class="box5" gives me some issues which I've highlighted in the comments above. I would like to know where I'm going wrong. Also, for slider I'm planning to change the margin-left/right properties. Is that the right way a slider is implemented? Help!!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload