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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.