7 Replies - 1491 Views - Last Post: 19 December 2013 - 12:17 PM

#1 iLiTH  Icon User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 94
  • Joined: 25-August 13

(Very) Simple Slider Giving Unexpected Results

Posted 19 December 2013 - 09:00 AM

Alright, so I've got this really frikkin' simple slider script...
$(function(){
    $('.sliderContent li:gt(0)').hide();
    setInterval(function(){
      $('.sliderContent :first-child').fadeOut()
         .next('li').fadeIn()
         .end().appendTo('.sliderContent');}, 
      3000);
});


And it does cycle through the li's. I've got only two li's currently in the ul, so it looks like this...
<div class="slider">
	<ul class="sliderContent">
		<li>
			<iframe width="100%" height="315" src="blahblah" frameborder="0" allowfullscreen></iframe>
		</li>
		
		<li>
			<img src="blahblah" style="width: 100%; height: 100%;" />
		</li>
	</ul>
</div>


But when it gets past the iframe (which does display) it doesn't show the image (or the image doesn't have long enough to display?) and then after the image it seems to fabricate two additional li's. I spent a bit watching it in the Web Inspector of Safari, and that's what it seemed to do.

Any advice? ^^

Is This A Good Question/Topic? 0
  • +

Replies To: (Very) Simple Slider Giving Unexpected Results

#2 laytonsdad  Icon User is offline

  • Cheese and Sprinkles
  • member icon

Reputation: 404
  • View blog
  • Posts: 1,720
  • Joined: 30-April 10

Re: (Very) Simple Slider Giving Unexpected Results

Posted 19 December 2013 - 11:38 AM

It works fine with text in place of the iframe and image, My guess is the amount of time it takes to load such large elements.
Was This Post Helpful? 0
  • +
  • -

#3 iLiTH  Icon User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 94
  • Joined: 25-August 13

Re: (Very) Simple Slider Giving Unexpected Results

Posted 19 December 2013 - 11:41 AM

Then should I use a buffer THEN begin the slideshow? I literally have almost no experience with jQuery. :P
Was This Post Helpful? 0
  • +
  • -

#4 laytonsdad  Icon User is offline

  • Cheese and Sprinkles
  • member icon

Reputation: 404
  • View blog
  • Posts: 1,720
  • Joined: 30-April 10

Re: (Very) Simple Slider Giving Unexpected Results

Posted 19 December 2013 - 11:44 AM

The main problem I think will be with the iframe. It is loading an entire page in a new dom.

The images you can just preload and that will help.
Was This Post Helpful? 0
  • +
  • -

#5 iLiTH  Icon User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 94
  • Joined: 25-August 13

Re: (Very) Simple Slider Giving Unexpected Results

Posted 19 December 2013 - 11:57 AM

Well, I can remove the iframe since it's only purpose is to hold a video anyway. I can add images that link to it. As for preloading, I don't get how to do that yet. I'll read up on it.
Was This Post Helpful? 0
  • +
  • -

#6 laytonsdad  Icon User is offline

  • Cheese and Sprinkles
  • member icon

Reputation: 404
  • View blog
  • Posts: 1,720
  • Joined: 30-April 10

Re: (Very) Simple Slider Giving Unexpected Results

Posted 19 December 2013 - 12:01 PM

You are loading an iframe for a video? Where is the video, youtube?
Was This Post Helpful? 0
  • +
  • -

#7 iLiTH  Icon User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 94
  • Joined: 25-August 13

Re: (Very) Simple Slider Giving Unexpected Results

Posted 19 December 2013 - 12:14 PM

Yeah, using their embed thing. I really want to make my own flash video player, but I can't get around to it ATM.
Was This Post Helpful? 0
  • +
  • -

#8 laytonsdad  Icon User is offline

  • Cheese and Sprinkles
  • member icon

Reputation: 404
  • View blog
  • Posts: 1,720
  • Joined: 30-April 10

Re: (Very) Simple Slider Giving Unexpected Results

Posted 19 December 2013 - 12:17 PM

Have a look at the API refrence for this.

You will get it done better this way.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1