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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

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

jquery image gallery


Go to End


5 Posts   2608 Views

Avatar
rogerw

Community Member, 4 Posts

17 March 2009 at 7:51am

Hi

I am trying to implement a jquery image gallery like jqgalscroll, but I can't get it to work. If I set it up with a plain html file, it works.

Here is the required code http://benjaminsterling.com/jquery-jqgalscroll-photo-gallery

This is what I have tried in SS:

in /mysite/code/page.php

Requirements::javascript('mysite/javascript/jqgalscroll.js');
Requirements::javascript('http://code.jquery.com/jquery-latest.pack.js');
Requirements::css('mysite/css/jqGalScroll.css');

then I have put this function in /themes/mytheme/templates/page.ss

<script type="text/javascript">
$(document).ready(function() {
$('#demoOne').jqGalScroll();
});
</script>

and also tried to have it in my /mysite/code/page.php

Requirements::customScript("
(function($){
$(document).ready(function() {
$('#demoOne').jqGalScroll();
});
})(jQuery);
");

Anyone here see what I am doing wrong?

Avatar
UncleCheese

Forum Moderator, 4102 Posts

17 March 2009 at 9:39am

You should probably include the jquery framework first if your gallery plugin depends on it.

Avatar
rogerw

Community Member, 4 Posts

17 March 2009 at 9:42am

Yes, got it there... Requirements::javascript('http://code.jquery.com/jquery-latest.pack.js');

Avatar
UncleCheese

Forum Moderator, 4102 Posts

17 March 2009 at 9:44am

But in your code it's below the jqgalscroll.js... right?

Avatar
rogerw

Community Member, 4 Posts

17 March 2009 at 9:54am

That was it, thank you thank you thank you... couldn't see it myself :)