1267 Posts in 351 Topics by 486 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 758 Views |
-
$SilverStripeNavigator breaks my jQuery script

23 November 2010 at 4:52am
How do I tell my jquery script to use something else than $ ?
Do I have to change all the $ to _$ ?
This is my script
$(document).ready(function() {
$('.slideshow').cycle({
fx: 'fade',
timeout: 6000
});
}); -
Re: $SilverStripeNavigator breaks my jQuery script

23 November 2010 at 5:00am
Hi,
try this in your script:
(function($) {
$(document).ready(function(){
// your jquery awesomeness.
})})(jQuery);
more info here: http://doc.silverstripe.org/javascript
Cheers,
Christian -
Re: $SilverStripeNavigator breaks my jQuery script

23 November 2010 at 5:12am
Works like a charm. Thank you!
-
Re: $SilverStripeNavigator breaks my jQuery script

12 December 2010 at 9:28pm
Or use JQuery.NoConflict
-
Re: $SilverStripeNavigator breaks my jQuery script

15 December 2010 at 11:36am
To expand on biapar's reply, something like this will stop your custom scripts from interfering with other scripts already using the $ namespace / function:
$.noConflict();
jQuery(document).ready(function() {
jQuery('#myid').click(....)
});
| 758 Views | ||
|
Page:
1
|
Go to Top |



