ASPX templates
Version 5.x > ASPX templates > slider with jQuery problem View modes: 
User avatar
Member
Member
simonstre - 5/18/2010 2:25:24 PM
   
slider with jQuery problem
Hi there!

I need to put an image slider in Kentico, and I'm requested to do so with client-side script. So I used the nivo-slider, after testing it in visual studio 2008 successfully. Unfortunately, I'm unable to make it work in Kentico, and after several hours of tests, I found that it was the following script that didn't work :


<script type="text/javascript">
$(window).load(function() {
$('#slider').nivoSlider();
}
</script>

I verified the stylesheets, the images and the js files, and they are all accessible and correct. You can see a live example of what I've done yet by clicking here.

Anybody as an idea of what am I doing wrong? Thanks!

User avatar
Kentico Support
Kentico Support
kentico_radekm - 5/22/2010 3:28:01 AM
   
RE:slider with jQuery problem
Hello.

We have modified a jQuery in version 5.0 to be noConflict(), because of avoid problems with lightbox, mootools JS framework, etc..
Therefore, the javascript function $() does not work now. You need to replace all $() by jQuery.

For example, you need to replace "$(document).ready(function() {" by "jQuery(document).ready(function() {" (everywhere).

Best Regards,
Radek Macalik

User avatar
Member
Member
eg.uribe-scare.org - 2/3/2012 10:44:04 AM
   
RE:slider with jQuery problem

Hello. Im using the Nivo-slider too, but im too newbie in Kentico. I wonder if you could help me a bit in 2 topics.
1. Where can I put .js files? I have tried pasting them in My portal\CMSTemplates\Scare\Js\nivo-slider and I recall them with "
<script type="text/javascript" src="~/CMSTemplates/Scare/Js/novo-slider/jquery.nivo.slider.pack.js">
</script>"

2. I wonder if you could make it works putting 'jQuery' instead the '$' .

I would be so thankful if you could help me.

User avatar
Kentico Support
Kentico Support
kentico_zdenekc - 2/20/2012 7:45:10 AM
   
RE:slider with jQuery problem
Hi,

1. You can put your files either in the CMSTemplates folder as you do or also into CMSScripts/<your site project name or similar>...
The choice of the folder is important mostly for Import/Export feature - see devnet.kentico.com/docs/6_0/devguide/folder_structure_and_importexport.htm
Your current scripts location is good.
Javascripts are best loaded in the head HTML section, you can use web part Head HTML code for this purpose in your page templates (mostly in the master page).

2. I'm not sure I properly understand, but the jQuery bundled with our default installation (which we recommend to use) is in noConflict version, jQuery() instead of $() or $j() is the only possible usage.
You can find it in CMSScripts/jquery, it can be loaded in code using ScriptHelper.RegisterJQuery()

Regards,
Zdenek