Jump to:

22972 Posts in 11596 Topics by 2824 members

General Questions

SilverStripe Forums » General Questions » 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
Go to End
Author Topic: 587 Views
  • Webdoc
    Avatar
    Community Member
    329 Posts

    javascript problem Link to this post

    added jquery elastic trumpnail video but it uses the jquery script that dont run
    <script type="text/javascript">
    $(document).ready(function() {
       $('.menueitem img').animate( {width: 125}, 0);
       $('.menueitem').mouseover(function(){
       gridimage = $(this).find('img');
       gridimage.stop().animate( {width: 150}, 150);
       }).mouseout(function(){ gridimage.stop().animate({width: 125}, 125);
    });
    });
    </script>

    and also not if i add it as .js

    <script type="text/javascript" src="tooted.js"></script>

    how can it be fixed

    in here it doesnt work its silverstripe - http://www.alpinacolor.ee/tooted/

    and in here it work just php file http://www.chillweb.eu/asaal/

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: javascript problem Link to this post

    Make sure you are developing with firebug (firefox plugin) enabled. Helps debugging these things. You have an error "$(".menuitem img") is null so I'm guessing that $(".menuitem") is returning an empty set.

  • Webdoc
    Avatar
    Community Member
    329 Posts

    Re: javascript problem Link to this post

    Have any idea what it is because in my own server it works fine only in silverstripe it gives error

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: javascript problem Link to this post

    SS would be loading its own JS so it could be due to a conflict. Make sure your JS is wrapped in a closure like - http://doc.silverstripe.org/doku.php?id=jquery#guidelines

  • Webdoc
    Avatar
    Community Member
    329 Posts

    Re: javascript problem Link to this post

    found the solution thanx willr.

    587 Views
Page: 1
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.