Hide the text of the paragraph when it is outside the div
Hey guys!
I am quite new to jQuery and I would like to make a simple slider where the images would fade in while the text would slide in from the left in the same time, over the image.
This is how my HTML code is structured:
- <div id="container">
- <div id="cine-suntem">
- <div class="slide" id="slide1">
- <img src="images/yumm-pizza1.jpg" alt="Image Slide Pizza" width="581" height="342">
- <p class="normal" id="normal1">Cel mai simplu si rapid mod sa te</p>
- <p class="normal" id="normal2">hotarasti ce vrei sa comanzi acasa</p>
- </div>
-
- <div class="slide" id="slide2"><img src="images/yumm-pizza2.jpg" alt="Image Slide Pizza" width="581" height="342">
- <p class="normal" id="normal1">Bucurate de cele mai bune</p>
- <p class="normal" id="normal2">oferte de home-delivery de la malul marii!</p>
- </div>
- <div class="slide" id="slide3"><img src="images/yumm-pizza3.jpg" alt="Image Slide Pizza" width="581" height="342">
- <p class="normal" id="normal1">Bucurate de cele mai bune</p>
- <p class="normal" id="normal2">oferte de home-delivery de la malul marii!</p>
- </div>
- </div>
- </div>
Here is my script :
- $("#cine-suntem > div:gt(0)").hide();
- setInterval(function() {
- $(".normal").animate({left: 5, opacity: 1}, 2000 , "swing");
- $('#cine-suntem > div:first')
- .fadeOut(1000)
- .next()
- .fadeIn(1000)
- .end()
- .appendTo('#cine-suntem');
- $(".normal").animate({left: -430, opacity: 0}, 3000 , "swing");
- }, 5000);
The problem is that I can see the text coming into the picture and going out. I want this to be invisible to the user :D
Thanks a lot for your help and time!