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

Replace big img Javascript problem


Reply


18 Posts   4212 Views

Avatar
frabraha

Community Member, 49 Posts

20 November 2009 at 12:31am

Think I have the javascript files added correctly now, and now I get another error..

$("ul.gallery").galleria is not a function

Avatar
banal

Community Member, 901 Posts

20 November 2009 at 12:45am

Try the following:

<script type="text/javascript">
;(function($) {
   $(function(){
      $('ul.gallery').galleria();
   });
})(jQuery);
</script>

Avatar
frabraha

Community Member, 49 Posts

20 November 2009 at 12:49am

same error..

Avatar
banal

Community Member, 901 Posts

20 November 2009 at 1:37am

Are you sure all files are being included and loaded correctly? Best way to check this is probably the "Net" tab in firebug. Also make sure you don't include files twice (via Requirements::javascript and/or directly in code).

Avatar
frabraha

Community Member, 49 Posts

21 November 2009 at 12:50am

yes, have checked the firebug net and it says that they are being added correctly, and no they are not included twice..

But still get "jQuery is not defined" error.

Avatar
frabraha

Community Member, 49 Posts

21 November 2009 at 2:18am

Did a quick search online and found someone that wrote:

"jQuery 1.3.2 no longer uses the @ convention and this is why galleria is choking. The simple fix to make Galleria work with jQuery 1.3.2 is to open your galleria.js file and replace all occurrences of @rel with rel"

Tried to find the @rel, but that must have been fixed..?

Avatar
banal

Community Member, 901 Posts

21 November 2009 at 2:26am

Or you could use jQuery 1.2.6: http://jqueryjs.googlecode.com/files/jquery-1.2.6.min.js

Avatar
frabraha

Community Member, 49 Posts

21 November 2009 at 2:42am

Edited: 21/11/2009 3:21am

No, that didn't work. Have tried the other version of jQuery to, but still get the same error message.

This is starting to get a little frustrating..

Here's how I have added it:

In page.php (firebug says it loads fine, and yes I did try to add those in page.ss head tag to):

Requirements::javascript("themes/tutorial/js/jquery.galleria.js");    
Requirements::javascript("themes/tutorial/js/jquery.min.js");

In articlepage.ss

<ul class="gallery">
<% control Attachment %>
<li><a href="$SetWidth(470).Link" title="$Title">$SetWidth(70)</a></li>
<% end_control %>
</ul>

As far as I can see in the usage part on the galleria website, you only need to add ul class gallery and add the images in a il list.