Jump to content

Using jQuery Spy (pre populate div)


PKENGLISH

Recommended Posts

Hi,

 

I am trying to use the jQuery Spy found on this site: http://leftlogic.com/lounge/articles/jquery_spy2/.

 

The way I am using this is to call upon a php file that randomizes a list of div's on reload.  It works perfectly fine with the exception of the fact that it doesn't pre-populate the div so when the page is loaded there is nothing inside and you have to wait for it to fill.  Is there a way to take the first 10 divs (or last 10 so it doesnt repeat) from my php file and place it in the "#spyContainer"?

 

Here is my code in action: http://phaedrusdesign.com/temp/LinkSpy/

 

 

My actual code:

<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="spy.js"></script>


<script type="text/javascript">
  $(function() {
    /* returns a selection of HTML DIVs to be inserted in to 
        the #spyContainer in a spy-style */
		$('#spyContainer > div:gt(5)').fadeEachDown(); // initial fade
    /* returns a selection of HTML DIVs to be inserted in to 
        the #spyContainer in a spy-style */
    $('#spyContainer').spy({'ajax': 'news.php',
						'limit': '12',
						'fadeInSpeed': '500',
						'fadeLast': '1',
						'timeout': 1000
						}); 
  });
</script>


<div id="spyContainer">

</div>

 

Thanks in advance

 

 

Link to comment
https://forums.phpfreaks.com/topic/93697-using-jquery-spy-pre-populate-div/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.