Jump to:

23490 Posts in 18996 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Replace big img Javascript problem

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

Page: 1 2 3
Go to End
Author Topic: 3980 Views
  • frabraha
    Avatar
    Community Member
    49 Posts

    Re: Replace big img Javascript problem Link to this post

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

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

  • banal
    Avatar
    Community Member
    901 Posts

    Re: Replace big img Javascript problem Link to this post

    Try the following:

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

  • frabraha
    Avatar
    Community Member
    49 Posts

    Re: Replace big img Javascript problem Link to this post

    same error..

  • banal
    Avatar
    Community Member
    901 Posts

    Re: Replace big img Javascript problem Link to this post

    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).

  • frabraha
    Avatar
    Community Member
    49 Posts

    Re: Replace big img Javascript problem Link to this post

    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.

  • frabraha
    Avatar
    Community Member
    49 Posts

    Re: Replace big img Javascript problem Link to this post

    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..?

  • banal
    Avatar
    Community Member
    901 Posts
  • frabraha
    Avatar
    Community Member
    49 Posts

    Re: Replace big img Javascript problem Link to this post

    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.

    3980 Views
Page: 1 2 3
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.