2014-03-06 5 views
0

등급 기능을 수행하는 데 raty를 사용하고 있으며 팝 오버 내부에 표시하고 있습니다.부트 스트랩 popover 복제 코드

문제는 내가 두 번째로 클릭 할 때 내가 링크를 클릭 처음으로, 올바르게, 별을 생성하지만이다는 10 별 대신 5

$('#member1').popover({ 
    html: true, 
    placement: 'bottom', 
    content: function() { 
     return $($(this).data('contentwrapper')).html(); 
    } 
}).click(function() { 
    $('.star').each(function(el) { 
     $(this).raty({ 
      starOff : 'http://wbotelhos.com/raty/lib/images/star-off.png', 
      starOn : 'http://wbotelhos.com/raty/lib/images/star-on.png', 
      start: $(this).attr('data-rating') 
     }); 
    }); 
}); 
를 팝업 수 있도록, 별이, 복제

나는 fiddle에있는 오류를 복제합니다.

아무에게도이 문제를 해결할 수있는 방법을 알려 주실 수 있으며 별 5 개만 표시 할 수 있습니까?

감사합니다 !!!!

답변

0

나는 raty에 지나치게 익숙하지 않지만 코드를 두 번째 또는 세 번째로 실행하기 전에 기존 코드를 삭제해야하는 것처럼 보입니다.

$(this).raty('destroy'); 

그런 일이

0

이 코드를 검토하십시오 정확한도 구현을위한 raty의 문서를 확인

$('#member1').popover({ 
     html: true, 
     placement: 'bottom', 
     content: function() { 
      return $($(this).data('contentwrapper')).html(); 
     } 
    }).click(function() { 
     $('.star').each(function(el) { 
      $(this).raty('destroy'); 
      $(this).raty({ 

       starOff : 'http://wbotelhos.com/raty/lib/images/star-off.png', 
       starOn : 'http://wbotelhos.com/raty/lib/images/star-on.png', 
       start: $(this).attr('data-rating') 
      }); 

     }); 
    }); 

데모 : http://jsfiddle.net/x9WhH/3/