2013-03-16 1 views
0

으로 변경되었습니다. 최신 버전의 jQuery로 작업하는 Nivo 슬라이더를 얻으려고합니다. .live를 작동 시키려면 .live로 변경해야하지만 곧바로 스왑이 작동하지 않아야합니다. jQuery 1.9에서 어떻게 작동합니까?Nivo 슬라이더를 편집하여 .live가 .on

if(settings.directionNav){ 
     slider.append('<div class="nivo-directionNav"><a class="nivo-prevNav">'+ settings.prevText +'</a><a class="nivo-nextNav">'+ settings.nextText +'</a></div>'); 

     $('a.nivo-prevNav', slider).live('click', function(){ 
      if(vars.running) { return false; } 
      clearInterval(timer); 
      timer = ''; 
      vars.currentSlide -= 2; 
      nivoRun(slider, kids, settings, 'prev'); 
     }); 

     $('a.nivo-nextNav', slider).live('click', function(){ 
      if(vars.running) { return false; } 
      clearInterval(timer); 
      timer = ''; 
      nivoRun(slider, kids, settings, 'next'); 
     }); 
    } 
+1

당신은 단지 새 복사본을 다운로드 할 수 있을까? 나는 그들이 그것을 바꿨을 때 확실하지 않지만 이것에 대해 "find"를 자유롭게해라. http://demo.dev7studios.com/nivo-slider/wp-content/plugins/nivo-slider/scripts/nivo- slider/jquery.nivo.slider.pack.js? ver = 3.5.1 - 확신합니다.'.live()'가 없습니다. – ahren

+0

나는 사이트에 갔고 ​​jquery 1.7 이상에 대해 말했지만 여전히 거기 있다고 가정했다. –

답변

2

$('{element_identifier'}).live(fn)는, 그래서 여기에 $(document).on('evt', '{element_identifier}', fn)에 해당 내가 할 것 스왑의 :

if(settings.directionNav){ 
     slider.append('<div class="nivo-directionNav"><a class="nivo-prevNav">'+ settings.prevText +'</a><a class="nivo-nextNav">'+ settings.nextText +'</a></div>'); 

     $(document).on('click', 'a.nivo-prevNav, a.nivo-directionNav', function(){ 
      if(vars.running) { return false; } 
      clearInterval(timer); 
      timer = ''; 
      vars.currentSlide -= 2; 
      nivoRun(slider, kids, settings, 'prev'); 
     }); 

     $(document).on('click', 'a.nivo-nextNav', function(){ 
      if(vars.running) { return false; } 
      clearInterval(timer); 
      timer = ''; 
      nivoRun(slider, kids, settings, 'next'); 
     }); 
    }