0
votes

I´m trying to run nivo slider in a joomla 2.5 site and too a custom html+php module where I need to put a datepicker.

In the custom module I insert this code:

<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/datepicker.js"></script>
<link rel="stylesheet" type="text/css" href="css/datepicker.css" />
<?php
/* Here the code for the module */

Nivo slider inserts this html code:

<script type="text/javascript">
jQuery.noConflict();
jQuery(window).load(function() {
jQuery('#vt_nivo_slider196').nivoSlider({
effect: 'fade', // Specify sets like: 'fold,fade,sliceDown'
...
});
});
</script>

So with this code I can´t see the calendar (datepicker) and nivo slider doesn´t work (only a white space is shown).

If I delete the line jQyery.noConflict(); in the nivo slider code then I can see the calendar (datepicker) but nivo slider still doesn´t work (only a white space is shown).

If I delete the line with script type="text/javascript" src="js/jquery-1.4.2.min.js"> then I can see nivo slider working, buy I don´t see the calendar (datepicker).

In datepicker.js I have $(document).ready(function() { $(function() { ('#linkedDatepicker') ... more code, and (function($){$.extend($.ui,{datepicker:{version:"1.7.2"}});var PROP_NAME="datepicker";function Datepicker(){ ... more code

It seems to be a conflict with JQuery but I don´t know how to solve it.

Any help is highly appreciated.!

2

2 Answers

0
votes

According to NivoSlider's website, it requires jQuery 1.7+.

Upgrade your version of jQuery, and eventually your version of datepicker and everything should be fine.

NB: jQyery.noConflict(); is only if you use another javascript library at the same time as jQuery.

0
votes

Thank you Skawal for answering.

Not sure about what was happening, but it seems to be solved after many trials. I think it may help someone with similar problems, so here the steps that I followed:

1) Delete jquery-1.4.2.min.js call in the module code, now only calling datepicker.js

2) In datepicker.js

2.1) I had before $(document).ready(function() { $(function() { ('#linkedDatepicker') ... more code, now replaced all $ symbols in the code by the chain jQuery, so now the code looks like jQuery(document).ready(function() { … more code

I don´t know why but $ seems to be getting something wrong.

2.2) I had before (function($){$.extend($.ui,{datepicker:{version:"1.7.2"}});var PROP_NAME="datepicker";function Datepicker(){ ... more code, now replaced with new datepicker version downloaded from JQuery site. jquery-ui-1.9.2.custom.min.js added replacing the code before (added al code from jquery-ui-1.9.2.custom.min.js includes: jquery.ui.core.js, jquery.ui.datepicker.js). Now code starts with function(e,t){function i(t,i){var ... more code

Last problem was calendar visualization was getting in the background of nivo slider image, solved changing datepicker.css adding a z-index rule: #ui-datepicker-div { width: 180px; z-index:50 !important;}