Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

JQuery Slideshow Woes


Reply


3 Posts   2077 Views

Avatar
OutrunTheWolf

Community Member, 34 Posts

1 August 2009 at 12:21am

Edited: 01/08/2009 12:24am

Hi All,

I am trying to get JQuery Slideshow working on a website.

I just can't seem to get it to work, the images are not rotating, merely tile over one another, no effects.

Here is my code as it is now.

Homepage.php - Javascript requirements

   function init() {
   parent::init();
   Requirements::Javascript("mysite/javascript/slideshow.js");
   Requirements::Javascript("mysite/javascript/jquery.js");
   Requirements::customScript("
         $(document).ready(function() {
         $('#slideshow').slideshow({
            timeout: 2000,
            type: 'random',
            pauselink: 'pause1',
            pausecallback: function(self){
               self.html('Play')
            },
            playcallback: function(self){
               self.html('Pause');
            }
         });
         $('#slideshow2').slideshow({
            timeout: 2000,
            type: 'sequence',
            pauselink: 'pause2'
         });
    });
   ");
   }

Homepage.ss - The Slideshow HTML

<div id="slideshow">

<a href="1"><img src="/../../../assets/darksideofthemoon.jpg" alt="" /></a>
<a href="2"><img src="/../../../assets/absolution.jpg" alt="" /></a>
<a href="3"><img src="/../../../assets/acertaintrigger.jpg" alt="" /></a>
<a href="4"><img src="/../../../assets/liberationtransmission.jpg" alt="" /></a>
<a href="5"><img src="/../../../assets/americanidiot.jpg" alt="" /></a>

</div>

I'm still a little clueless when it come to using Javascript with Silverstripe. Am I doing this right? If not, can anyone show me the exact way to implement this?

Thanks

Avatar
Taffy

Community Member, 119 Posts

1 August 2009 at 1:19am

Maybe this will help http://ssbits.com/working-with-banners/

Avatar
OutrunTheWolf

Community Member, 34 Posts

2 August 2009 at 6:50am

Yeah, thats the exact thing I want to do. The problem is I can't get it working.

I need to know if my code is in the right place....

Can anyone please help? I'm obviously missing something simple