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

javascript problem


Reply

5 Posts   630 Views

Avatar
Webdoc

25 October 2009 at 6:09pm (Last edited: 25 October 2009 6:14pm), Community Member, 332 Posts

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/

Avatar
Willr

25 October 2009 at 6:26pm Forum Moderator, 5511 Posts

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.

Avatar
Webdoc

25 October 2009 at 6:29pm Community Member, 332 Posts

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

Avatar
Willr

25 October 2009 at 6:41pm Forum Moderator, 5511 Posts

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

Avatar
Webdoc

25 October 2009 at 6:55pm Community Member, 332 Posts

found the solution thanx willr.