Un Evento Unico. 5 Sale. 27 Interventi. SEO, SOCIAL, E-Commerce, Mobile, Turismo.
CLICCA QUI e SCOPRI DI PIù X Chiudi
 
Forum GT: Condividiamo idee e conoscenza Forum GT: Condividiamo idee e conoscenza


Condividi questo contenuto nei Social Network:
Ti stiamo aspettando: Registrati subito e gratis. Entra a far parte di una delle comunità più attive in Italia. Se hai dimenticato i tuoi dati li puoi recuperare subito.


Vai indietro   Forum per Webmaster: Condividiamo Idee e Conoscenza > Sviluppo e Gestione siti web > Scripting lato client
Benvenuto! Forum Regole FAQ Lista utenti Calendario Segna come letti


Rispondi
 
LinkBack Strumenti di discussione
Vecchio 24-11-11, 22:29   #1 (permalink)
User Newbie
 
Data di registrazione: Oct 2010
Messaggi: 9
Conflitto jQuery

Ciao a tutti,

scrivo per un problema che non riesco a risolvere: ho una pagina in cui sono presenti i seguenti script:

<script src="js/bacheca_notizie_home_page/cufon-yui.js" type="text/javascript"></script>

<script src="js/bacheca_notizie_home_page/Bebas_400.font.js" type="text/javascript"></script>

<script type="text/javascript">
Cufon('.cn_wrapper h1,h2', {
textShadow: '-1px 1px black'
});
</script>

<script type="text/javascript" src="js/bacheca_notizie_home_page/jquery.min.js"></script>

<script type="text/javascript" src="js/bacheca_notizie_home_page/jquery.easing.1.3.js"></script>

<script type="text/javascript" src="js/calendario_eventi/jquery-1.4.2.js"></script>

<script type="text/javascript" src="js/calendario_eventi/jCalendar-1.0.0.js"></script>


e queste due "function":

<script type="text/javascript">

$(function() {
//caching
//next and prev buttons
var $cn_next = $('#cn_next');
var $cn_prev = $('#cn_prev');
//wrapper of the left items
var $cn_list = $('#cn_list');
var $pages = $cn_list.find('.cn_page');
//how many pages
var cnt_pages = $pages.length;
//the default page is the first one
var page = 1;
//list of news (left items)
var $items = $cn_list.find('.cn_item');
//the current item being viewed (right side)
var $cn_preview = $('#cn_preview');
//index of the item being viewed.
//the default is the first one
var current = 1;

/*
for each item we store its index relative to all the document.
we bind a click event that slides up or down the current item
and slides up or down the clicked one.
Moving up or down will depend if the clicked item is after or
before the current one
*/
$items.each(function(i){
var $item = $(this);
$item.data('idx',i+1);

$item.bind('click',function(){
var $this = $(this);
$cn_list.find('.selected').removeClass('selected') ;
$this.addClass('selected');
var idx = $(this).data('idx');
var $current = $cn_preview.find('.cn_content:nth-child('+current+')');
var $next = $cn_preview.find('.cn_content:nth-child('+idx+')');

if(idx > current){
$current.stop().animate({'top':'-300px'},600,'easeOutBack',function(){
$(this).css({'top':'310px'});
});
$next.css({'top':'310px'}).stop().animate({'top':' 5px'},600,'easeOutBack');
}
else if(idx < current){
$current.stop().animate({'top':'310px'},600,'easeO utBack',function(){
$(this).css({'top':'310px'});
});
$next.css({'top':'-300px'}).stop().animate({'top':'5px'},600,'easeOut Back');
}
current = idx;
});
});

/*
shows next page if exists:
the next page fades in
also checks if the button should get disabled
*/
$cn_next.bind('click',function(e){
var $this = $(this);
$cn_prev.removeClass('disabled');
++page;
if(page == cnt_pages)
$this.addClass('disabled');
if(page > cnt_pages){
page = cnt_pages;
return;
}
$pages.hide();
$cn_list.find('.cn_page:nth-child('+page+')').fadeIn();
e.preventDefault();
});
/*
shows previous page if exists:
the previous page fades in
also checks if the button should get disabled
*/
$cn_prev.bind('click',function(e){
var $this = $(this);
$cn_next.removeClass('disabled');
--page;
if(page == 1)
$this.addClass('disabled');
if(page < 1){
page = 1;
return;
}
$pages.hide();
$cn_list.find('.cn_page:nth-child('+page+')').fadeIn();
e.preventDefault();
});

});

</script>

<script type="text/javascript">

$(document).ready(function(){
$("#calendarLayer").jCalendar({
'fadeout' : 10000,
'calendarBg' : '#ffffff',
'monthBarBg' : '#5a5a5a',
'monthBarText' : '#ffffff',
'currentDay' : '#d1cf21',
'eventHighlight' : '#336699',
'titleColor' : '#000000',
'width' : '279',
'textSize' : 0.9,
'titleAlign' : 'center',
'wrapperColor' : '#d0cfcf'
});
});

</script>


Fanno entrambe parte di due script free scaricati dal web, uno è un calendario eventi, l'altro è un box compatto di notizie.

Per come è scritto ora il codice, il calendario funziona correttamente mentre il problema me lo da il box notizie in quanto quando clicco su una notizia non accade niente mentre dovrebbe invece "aprirsi" l'articolo della notizia selezionata.

Cercando e provando ho trovato il famoso jQuery.noConflict() che però non mi ha risolto il problema.

Qualcuno saprebbe aiutarmi?

Vi ringrazio in anticipo.
Ivan
ivan_83_to non in linea   Rispondi citando
Vecchio 30-12-11, 22:08   #2 (permalink)
User
 
L'avatar di artasdog
 
Data di registrazione: Oct 2010
Ubicazione: brescia
Messaggi: 277
Visto che fortunatamente con Firebug si riesce tramite la console a fare il debug di javascript e quindi anche di jquery ti consiglio di seguire passo passo i punti critici che ti interessano e monitorarne ogni aspetto e variabile.
Vista la lunghezza del tuo codice e la presenza di altro codice precostituito da dover comprendere, rispondere alla tua domanda potrebbe richiedere delle ore così com'è.
__________________
Risposte http://www.daext.com
artasdog non in linea   Rispondi citando
Rispondi


Strumenti di discussione

Regole di scrittura
Non puoi postare nuove discussioni
Non puoi rispondere alle discussioni
Non puoi allegare file
Non puoi editare i tuoi post

BB code is Attivo
smilies è Attivo
[IMG] il codice è Attivo
Il codice HTML è Disattivato
Trackbacks are Attivo
Pingbacks are Attivo
Refbacks are Disattivato
Vai al forum



Tutti gli orari sono GMT +3. Attualmente sono le 20:25.




Forum GT - © 2004-2009 GT idea S.r.l P.iva 02418200800 - Privacy/Disclaimer

SEO by vBSEO 3.2.0 ©2008, Crawlability, Inc.