Visualizzazione dei risultati da 1 a 4 su 4
  1. #1
    Utente di HTML.it
    Registrato dal
    Apr 2006
    Messaggi
    70

    conflitto con jQuery.noConflict

    ciao ragazzi ho uno strano problema con il seguente script:

    codice:
    <script type='text/javascript'>
    jQuery.noConflict();
    (function($) {
    	$(function() {
    		$('.inviaadesione').click(function(){
    			switch ($("input[type=radio][name=scelta]:checked").val()){
    					case "1":
    						s="Si";
    						break;
    					case "2":
    						s="No";
    						break;
    					case "3":
    						s="Presa Visione";
    						break;
    				}
    			var answer = confirm("Circolare "+$(this).attr('rel') +"\nConfermi la scelta:\n\n   " + s +"?")
    			if (answer){
    				return true;
    			}
    			else{
    				return false;
    			}					
    		});
     });
    })(jQuery);
    </script>

    praticamente questo input radio a volte appare nella pagina altre no. l'unica spiegazione che mi viene in mente è che ci sia un conflitto con altri script.

    come posso trasformare questo codice in maniera che non mi dia questo problema?
    grazie in anticipo per l'attenzione

  2. #2
    Moderatore di Annunci siti web, Offro lavoro/collaborazione, Cerco lavoro L'avatar di cavicchiandrea
    Registrato dal
    Aug 2001
    Messaggi
    26,131
    Metti una pagina online per vederla in esecuzione e riporta qui il link
    Cavicchi Andrea
    Problemi con javascript, jquery, ajax clicca qui

  3. #3
    Utente di HTML.it
    Registrato dal
    Apr 2006
    Messaggi
    70
    Ciao Andrea grazie,
    ho provato a eseguire dalla console di firefox, sul pannello JS non appare nessun errore
    boh, no saprei come postartela perchè è in locale e il codice è abbastanza lungo non me lo fa inserire (il forum mi dice max 13000 caratteri), provo a metterti un post con header e uno con footer, entrambi hanno script, ma quello in questione è alla riga 67:

    codice:
    <!DOCTYPE html>
    
                <head>
    
    
                   <title>Sciopero</title>
    
    
                   <!--[if lt IE 9]>
                   <script src="localhost/wp-content/themes/template/js/html5.js" type="text/javascript"></script>
                   <![endif]-->
    
    
                   <script type="text/javascript">
                      window._wpemojiSettings = {"baseUrl":"https:\/\/s.w.org\/images\/core\/emoji\/72x72\/","ext":".png","source":{"concatemoji":"http:\/\/localhost\/sito\/wp-includes\/js\/wp-emoji-release.min.js?ver=4.5.4"}};
                      !function(a,b,c){function d(a){var c,d,e,f=b.createElement("canvas"),g=f.getContext&&f.getContext("2d"),h=String.fromCharCode;if(!g||!g.fillText)return!1;switch(g.textBaseline="top",g.font="600 32px Arial",a){case"flag":return g.fillText(h(55356,56806,55356,56826),0,0),f.toDataURL().length>3e3;case"diversity":return g.fillText(h(55356,57221),0,0),c=g.getImageData(16,16,1,1).data,d=c[0]+","+c[1]+","+c[2]+","+c[3],g.fillText(h(55356,57221,55356,57343),0,0),c=g.getImageData(16,16,1,1).data,e=c[0]+","+c[1]+","+c[2]+","+c[3],d!==e;case"simple":return g.fillText(h(55357,56835),0,0),0!==g.getImageData(16,16,1,1).data[0];case"unicode8":return g.fillText(h(55356,57135),0,0),0!==g.getImageData(16,16,1,1).data[0]}return!1}function e(a){var c=b.createElement("script");c.src=a,c.type="text/javascript",b.getElementsByTagName("head")[0].appendChild(c)}var f,g,h,i;for(i=Array("simple","flag","unicode8","diversity"),c.supports={everything:!0,everythingExceptFlag:!0},h=0;h<i.length;h++)c.supports[i[h]]=d(i[h]),c.supports.everything=c.supports.everything&&c.supports[i[h]],"flag"!==i[h]&&(c.supports.everythingExceptFlag=c.supports.everythingExceptFlag&&c.supports[i[h]]);c.supports.everythingExceptFlag=c.supports.everythingExceptFlag&&!c.supports.flag,c.DOMReady=!1,c.readyCallback=function(){c.DOMReady=!0},c.supports.everything||(g=function(){c.readyCallback()},b.addEventListener?(b.addEventListener("DOMContentLoaded",g,!1),a.addEventListener("load",g,!1)):(a.attachEvent("onload",g),b.attachEvent("onreadystatechange",function(){"complete"===b.readyState&&c.readyCallback()})),f=c.source||{},f.concatemoji?e(f.concatemoji):f.wpemoji&&f.twemoji&&(e(f.twemoji),e(f.wpemoji)))}(window,document,window._wpemojiSettings);
                   </script>
    
    
    
    
                   <script type='text/javascript' src='localhost/wp-includes/js/jquery/jquery.js?ver=1.12.4'></script>
                   <script type='text/javascript' src='localhost/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.4.1'></script>
                   <script type='text/javascript' src='localhost/wp-content/plugins/revslider/rs-plugin/js/jquery.themepunch.tools.min.js?ver=4.6.93'></script>
                   <script type='text/javascript' src='localhost/wp-content/plugins/revslider/rs-plugin/js/jquery.themepunch.revolution.min.js?ver=4.6.93'></script>
                   <script type='text/javascript' src='localhost/wp-content/plugins/useful-banner-manager/scripts.js?ver=4.5.4'></script>
                   <script type='text/javascript' src='localhost/wp-content/sedlex/inline_scripts/40b347d7d3ed5b764a5ccbaaf002f9edaf499650.js?ver=20161111'></script>
                   <link rel='https://api.w.org/' href='localhost/wp-json/' />
    
    
                   <meta name="generator" content="WordPress 4.5.4" />
    
    
                   <script type='text/javascript' src='localhost/wp-includes/js/tw-sack.min.js?ver=1.6.1'></script>
                   <script type="text/javascript">
                      //<=!=[=C=D=A=T=A=[
                              function alo_em_user_form ( opt )
                      {
                          
                          // updating...
                          document.getElementById('alo_easymail_widget_feedback').innerHTML = '';
                          document.getElementById('alo_easymail_widget_feedback').className = 'alo_easymail_widget_error';
                          document.getElementById('alo_em_widget_loading').style.display = "inline";
                      
                          var alo_em_sack = new sack(
                              "localhost/wp-admin/admin-ajax.php" );
                      
                          alo_em_sack.execute = 1;
                          alo_em_sack.method = 'POST';
                          alo_em_sack.setVar( "action", "alo_em_user_form_check" );
                          alo_em_sack.setVar( "alo_easymail_option", opt );
                                                  alo_em_sack.setVar( "alo_easymail_txt_generic_error", 'Errore durante l\'operazione.' );
                          alo_em_sack.setVar( "alo_easymail_txt_success", 'Aggiornato con successo' );
                          alo_em_sack.setVar( "alo_easymail_txt_need_sub", 'Prima di modificare altri campi devi selezionare la scelta di iscrizione' );
                          alo_em_sack.setVar( "alo_easymail_lang_code", 'it' );
                                      var cbs = document.getElementById('alo_easymail_widget_form').getElementsByTagName('input');
                          var length = cbs.length;
                          var lists = "";
                          for (var i=0; i < length; i++) {
                              if (cbs[i].name == 'alo_em_form_lists' +'[]' && cbs[i].type == 'checkbox') {
                                  if ( cbs[i].checked ) lists += cbs[i].value + ",";
                              }
                          }
                          alo_em_sack.setVar( "alo_em_form_lists", lists );
                          alo_em_sack.setVar( "alo_em_nonce", 'bba1d3e49f' );
                          //alo_em_sack.onError = function() { alert('Ajax error' )};
                          alo_em_sack.runAJAX();
                      
                          return true;
                      
                      }
                              //]=]=>
                   </script>
                   <script type='text/javascript'>
                      jQuery.noConflict();
                      (function($) {
                          $(function() {
                              $('.inviaadesione').click(function(){
                                  switch ($("input[type=radio][name=scelta]:checked").val()){
                                          case "1":
                                              s="Si";
                                              break;
                                          case "2":
                                              s="No";
                                              break;
                                          case "3":
                                              s="Presa Visione";
                                              break;
                                      }
                                  var answer = confirm("Circolare "+$(this).attr('rel') +"\nConfermi la scelta:\n\n   " + s +"?")
                                  if (answer){
                                      return true;
                                  }
                                  else{
                                      return false;
                                  }                    
                              });
                       });
                      })(jQuery);
                   </script>
                   <script type="text/javascript">
                      jQuery(document).ready(function() {
                          // CUSTOM AJAX CONTENT LOADING FUNCTION
                          var ajaxRevslider = function(obj) {
                          
                              // obj.type : Post Type
                              // obj.id : ID of Content to Load
                              // obj.aspectratio : The Aspect Ratio of the Container / Media
                              // obj.selector : The Container Selector where the Content of Ajax will be injected. It is done via the Essential Grid on Return of Content
                              
                              var content = "";
                      
                              data = {};
                              
                              data.action = 'revslider_ajax_call_front';
                              data.client_action = 'get_slider_html';
                              data.token = '54d51c5e26';
                              data.type = obj.type;
                              data.id = obj.id;
                              data.aspectratio = obj.aspectratio;
                              
                              // SYNC AJAX REQUEST
                              jQuery.ajax({
                                  type:"post",
                                  url:"localhost/wp-admin/admin-ajax.php",
                                  dataType: 'json',
                                  data:data,
                                  async:false,
                                  success: function(ret, textStatus, XMLHttpRequest) {
                                      if(ret.success == true)
                                          content = ret.data;                                
                                  },
                                  error: function(e) {
                                      console.log(e);
                                  }
                              });
                              
                               // FIRST RETURN THE CONTENT WHEN IT IS LOADED !!
                               return content;                         
                          };
                          
                          // CUSTOM AJAX FUNCTION TO REMOVE THE SLIDER
                          var ajaxRemoveRevslider = function(obj) {
                              return jQuery(obj.selector+" .rev_slider").revkill();
                          };
                      
                          // EXTEND THE AJAX CONTENT LOADING TYPES WITH TYPE AND FUNCTION
                          var extendessential = setInterval(function() {
                              if (jQuery.fn.tpessential != undefined) {
                                  clearInterval(extendessential);
                                  if(typeof(jQuery.fn.tpessential.defaults) !== 'undefined') {
                                      jQuery.fn.tpessential.defaults.ajaxTypes.push({type:"revslider",func:ajaxRevslider,killfunc:ajaxRemoveRevslider,openAnimationSpeed:0.3});   
                                      // type:  Name of the Post to load via Ajax into the Essential Grid Ajax Container
                                      // func: the Function Name which is Called once the Item with the Post Type has been clicked
                                      // killfunc: function to kill in case the Ajax Window going to be removed (before Remove function !
                                      // openAnimationSpeed: how quick the Ajax Content window should be animated (default is 0.3)
                                  }
                              }
                          },30);
                      });
                   </script>
                
                </head>
                <body class="single single-circolari postid-4808 logged-in">
                   <header id="header">
                   </header>
                   
                   <content>
                    </content>
    Ultima modifica di LindaXp; 11-11-2016 a 11:51

  4. #4
    Utente di HTML.it
    Registrato dal
    Apr 2006
    Messaggi
    70
    e questo è il footer:

    codice:
                  <div id="toTop" style="display: block;"><i class="icon-angle-up"></i></div>               <script type='text/javascript' src='localhost/wp-includes/js/comment-reply.min.js?ver=4.5.4'></script>
                   <script type='text/javascript' src='localhost/wp-content/plugins/contact-form-7/includes/js/jquery.form.min.js?ver=3.51.0-2014.06.20'></script>
                   <script type='text/javascript'>
                      /* <![CDATA[ */
                      var _wpcf7 = {"loaderUrl":"http:\/\/localhost\/sito\/wp-content\/plugins\/contact-form-7\/images\/ajax-loader.gif","recaptchaEmpty":"Per favore dimostra che non sei un robot.","sending":"Invio..."};
                      /* ]]> */
                   </script>
                   <script type='text/javascript' src='localhost/wp-content/plugins/contact-form-7/includes/js/scripts.js?ver=4.4.2'></script>
                   <script type='text/javascript' src='localhost/wp-content/plugins/zeno-font-resizer/js/js.cookie.js?ver=1.6.3'></script>
                   <script type='text/javascript' src='localhost/wp-content/plugins/zeno-font-resizer/js/jquery.fontsize.js?ver=1.6.3'></script>
                   <script type='text/javascript' src='localhost/wp-content/themes/template/js/hoverIntent.js?ver=4.5.4'></script>
                   <script type='text/javascript' src='localhost/wp-includes/js/hoverIntent.min.js?ver=1.8.1'></script>
                   <script type='text/javascript' src='localhost/wp-content/themes/template/js/superfish.js?ver=4.5.4'></script>
                   <script type='text/javascript' src='localhost/wp-content/themes/template/js/jquery.easing.1.3.js?ver=4.5.4'></script>
                   <script type='text/javascript' src='localhost/wp-content/themes/template/js/jquery.flexslider-min.js?ver=4.5.4'></script>
                   <script type='text/javascript' src='localhost/wp-content/themes/template/js/lightbox.min.js?ver=4.5.4'></script>
                   <script type='text/javascript' src='localhost/wp-content/themes/template/js/jflickrfeed.min.js?ver=4.5.4'></script>
                   <script type='text/javascript' src='localhost/wp-content/themes/template/js/jquery.mobilemenu.js?ver=4.5.4'></script>
                   <script type='text/javascript' src='localhost/wp-content/themes/template/js/jquery.touchSwipe.min.js?ver=4.5.4'></script>
                   <script type='text/javascript' src='localhost/wp-content/themes/template/js/jquery.mousewheel.min.js?ver=4.5.4'></script>
                   <script type='text/javascript' src='localhost/wp-content/themes/template/js/custom.js?ver=4.5.4'></script>
                   <script type='text/javascript' src='localhost/wp-content/themes/template/js/jquery.simplyscroll.min.js?ver=4.5.4'></script>
                   <script type='text/javascript' src='localhost/wp-content/themes/template/js/wt-animate.min.js?ver=4.5.4'></script>
                   <script type='text/javascript' src='localhost/wp-includes/js/wp-embed.min.js?ver=4.5.4'></script>
                   <script type='text/javascript'>
                      /* <![CDATA[ */
                      var ec_ajax_data = {"ajax_url":"http:\/\/localhost\/sito\/wp-admin\/admin-ajax.php","codes":{"SUCCESS":1,"PREVIOUSLY_VOTED":0,"REQUEST_ERROR":2,"UNKNOWN":-1},"messages":{"success":"Voto inserito con successo!","previously_voted":"Hai gi\u00e0 votato.","request_error":"E' stato trovato un problema.","unknown":"Si \u00e8 verificato un errore."}};
                      /* ]]> */
                   </script>
                   <script type='text/javascript' src='localhost/wp-content/themes/template/js/wt-rating.js?ver=4.5.4'></script>
                   <script type='text/javascript' src='localhost/wp-content/themes/template/js/scrolltopcontrol.js'></script>
                </body>
             </html>

Tag per questa discussione

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.