JQuery Cycle Plugin how to with EE
Posted: 06 June 2008 01:20 PM   [ Ignore ]  
Grad Student
Avatar
Rank
Total Posts:  69
Joined  05-09-2007

I came across the JQuery Cycle Plugin mentioned in another post and would like to integrate it into my EE site. I’m not strong with javascript skills and was hoping to get some help setting up a basic example on my site.

Following the beginner demos, I downloaded the uncompressed plugin with all transitions and put the code into a new javascript template called “jquery”.

In my index page, I added the following code from their example:

<div class="pics">
    <
img src="http://www.mysite.com/images/test1.jpg" width="200" height="200" />
    <
img src="http://www.mysite.com/images/test1.jpg" width="200" height="200" />
    <
img src="http://www.mysite.com/images/test1.jpg" width="200" height="200" />
</
div>

I added the following CSS into another template:

.pics {  
    height
:  232px;  
    
width:   232px;  
    
padding: 0;  
    
margin:  0;  
}

.pics img {  
    padding
: 15px;  
    
border:  1px solid #ccc;  
    
background-color: #eee;  
    
width:  200px;
    
height: 200px;
    
top:  0;
    
left: 0
}

At this point, I was confused as to what I should put into the header of the page. To try to duplicate the first fading image example on the beginner’s page, I tried using the following in my header:

$(function() {

  
$('#s1').cycle('fade');
});

Any ideas of why this isn’t working? Thanks for any assistance.

Profile
 
 
Posted: 06 June 2008 01:37 PM   [ Ignore ]   [ # 1 ]  
Lab Assistant
RankRank
Total Posts:  284
Joined  06-20-2005

Hi,

Disclaimer, not a jQuery expert by any means. However, it seems as if the demo on that page is slightly confusing. The jQ function you have posted is targeting an element with ID s1. Your code does not have an ID at all. Therefore, try making your div like this:

<div id="s1" class="pics">
    <
img src="http://www.mysite.com/images/test1.jpg" width="200" height="200" />
    <
img src="http://www.mysite.com/images/test1.jpg" width="200" height="200" />
    <
img src="http://www.mysite.com/images/test1.jpg" width="200" height="200" />
</
div>

Cheers

Dry

 Signature 

   Purple Dogfish | Member of EE Pro Network

Profile
 
 
Posted: 06 June 2008 06:46 PM   [ Ignore ]   [ # 2 ]  
Summer Student
Total Posts:  1
Joined  08-23-2007

This might help, having the cycle plugin run after the DOM has loaded

$(document).ready(function() {
    
$('#s1').cycle('fade');
});

And as Drylouvre said the make the divs id ‘#s1’ or just make the js ‘$(’.pics’).cycle(‘fade’);’

Profile
 
 
Posted: 11 June 2008 02:15 PM   [ Ignore ]   [ # 3 ]  
Grad Student
Avatar
Rank
Total Posts:  69
Joined  05-09-2007

Thanks so much, that did just the trick!

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64907 Total Logged-in Users: 40
Total Topics: 81849 Total Anonymous Users: 36
Total Replies: 440052 Total Guests: 232
Total Posts: 521901    
Members ( View Memberlist )