2014-10-21 3 views
1

Rails 3.2 응용 프로그램에서 jQuery의 accordion 효과를 사용하려고합니다. 사용자가 신용 카드 또는 PayPal 중 하나를 선택할 수있는 간단한 화면입니다. 아코디언 기능 자체가 실제로 작동합니다. 그러나, 나는 그것이 내가 커피 스크립트에 함께 초기화 설정의 존중받을 수 없습니다 :jQuery 아코디언이 설정을 준수하지 않음

$('#paymentdiv').accordion -> 
    icons: false 
    heightStyle: 'content' 
    animate: 300 

아이콘은 여전히 ​​표시를 높이는 내용을 포함하는데 충분한 크기가 아닌, 그것은하지 않습니다 애니메이션을 설정하는 것과 상관없이 항상 동일합니다.

<div id="paymentdiv"> 
    <h3><%= image_tag "/img/promo/credit card title.png" %></h3> 
    <div id="creditcarddiv"> 
     <%= simple_form_for @subscription, url: wizard_path, method: :put, html: { class: 'form-horizontal' }, defaults: { label_html: { style: "width:200px;" } } do |f| %> 
     <% unless @subscription.errors.blank? %> 
      <div class="error_messages"> 
      <%= f.error_notification message: "We're sorry, but it appears that the information provided is incorrect or incomplete.", style: "color:#b94a48;" %> 
      <p>Please verify that the information provided is correct and try again.</p> 
      </div> 
     <% end %> 

     <%= f.input :payment_card_token, as: :hidden %> 
     <%= render 'credit_card_fields' %> 

     <div id="stripe_error" style="position:relative; padding-top:0px; margin-bottom:10px;"> 
      &nbsp; 
      <noscript>JavaScript is not enabled and is required for this form. First enable it in your web browser settings.</noscript> 
     </div> 
     <%= f.submit "Subscribe", type: :image, src: "/img/promo/Subscribe Button.png", id: "ebay_subscribe_button" %> 
     <%= link_to "Skip", next_wizard_path %> 
     <%= image_tag "/img/promo/Secure Server icon.png", id: "secure_server_image" %> 
     <% end %> 

    </div> 
    <h3><%= image_tag "/img/promo/PayPal.png" %></h3> 
    <div id="paypaldiv"> 
     <p>PayPal Here!</p> 
    </div> 
    </div> 

그래서 나는 아코디언을 위해 다음과 같은 형식으로 모든 것을 유지하고있어 :

<div id="accordion"> 
    <h3>Header1</h3> 
    <div> 
    ... 
    </div> 
    <h3>Header1</h3> 
    <div> 
    ... 
    </div> 
</div> 

지금까지 나도하고있는 커피 스크립트 틀렸다, 또는 내가 어떤 종류의 누락 내 가설 JS 또는 CSS를 지원합니다.

답변

0

MY 커피 문자가 잘못되었습니다. 함수를 전달해야 했으므로 -> 연산자를 사용하지 않아야했습니다. 해시를 전달하면 완벽하게 작동합니다.

$('#paymentdiv').accordion 
    collapsible: true 
    active: false 
    icons: false 
    heightStyle: 'content' 
    animate: 300