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.

Template Questions /

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

[ Javascripts ] Conflic with admin section


Go to End


6 Posts   2176 Views

Avatar
astate

Community Member, 35 Posts

18 January 2011 at 3:32pm

When i login on admin section of silverstripe, the javascripts don't work on website.

I htink the problem are because i use jquery and jquery-ui on my website.

Sorry my english are not very good.

Avatar
Willr

Forum Moderator, 5523 Posts

18 January 2011 at 4:00pm

Usually the CMS won't include any of your front end javascript. That is why have to explicitly load your javascript in the CMS.

Can you look at your web browsers error console and find the actual error. You may also what to try visiting the url - admin?flush=1&isDev=1 and try logging in. The flush is to refresh the cache, the isDev is used to disable the live mode JS minification.

Avatar
astate

Community Member, 35 Posts

18 January 2011 at 4:23pm

Edited: 18/01/2011 4:27pm

The problem are when i am on Published Site and $SilverStripeNavigator are active. My jquery dont work on the Published Site

Avatar
Willr

Forum Moderator, 5523 Posts

18 January 2011 at 5:24pm

Ensure you javascript is in a closure - http://doc.silverstripe.org/sapphire/en/topics/javascript#custom-jquery-code

Also include the built in sapphire jQuery rather than your own to avoid duplications.

Avatar
astate

Community Member, 35 Posts

19 January 2011 at 12:36am

i have my own jquery but i have already modify mod code.

     
 <script type="text/javascript">//<![CDATA[
	(function($) {
		$( "#accordion" ).accordion({
		   header: "h3", 
		   active: false,
		   collapsible: true,
			autoHeight: false,
			navigation: true
		});
	})(jQuery);

	$('.ppt li:gt(0)').hide();
$('.ppt li:last').addClass('last');
var cur = $('.ppt li:first');

function animate() {
	cur.fadeOut( 2000 );
	if ( cur.attr('class') == 'last' )
		cur = $('.ppt li:first');
	else
		cur = cur.next();
	cur.fadeIn( 2000 );
}
(function($) {
	setInterval( "animate()", 6000 );
} )(jQuery);		
//]]></script>

$SilverStripeNavigator

    </body> 
</html> 

Avatar
Willr

Forum Moderator, 5523 Posts

19 January 2011 at 10:53pm

All your code should be inside the 1 closure.

$('.ppt li:gt(0)').hide(); etc isn't in it.