2013-12-26 3 views
0

У меня есть bootstrap. Переключатель в шаблоне handlebars, в то время как время загрузки страницы прекрасно видно, но после переустановки шаблона руля (какой шаблон переключить) это не видно.Как я могу сделать bootstrap toggle

Перед повторным Шаблон:

Before Re-Template

код:

<div class="switch switch-square has-switch" data-on-label="&lt;i class='fui-check'&gt;&lt;/i&gt;" data-off-label="&lt;i class='fui-cross'&gt;&lt;/i&gt;"><div class="switch-animate switch-off"><input type="checkbox" id="colorBar-Toggle"><span class="switch-left"><i class="fui-check"></i></span><label for="colorBar-Toggle">&nbsp;</label><span class="switch-right"><i class="fui-cross"></i></span></div></div> 

После повторного Шаблон:

enter image description here

после кода Re-шаблона:

<div class="switch switch-square" data-on-label="&lt;i class='fui-check'&gt;&lt;/i&gt;" data-off-label="&lt;i class='fui-cross'&gt;&lt;/i&gt;"><input type="checkbox" id="colorBar-Toggle"></div> 

Рули код:

 <script id="planner-template" type="text/x-handlebars-template"> 

    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="table table-bordered table-responsive" id="joy_fifth" data-intro="5. You are now ready to play with the planner!" data-position="top"> 
     <thead> 
      <tr>  
       <th width="20%">Bizstep</td> 
       <th width="20%">Location</td> 
       <th width="15%">Time Duration</td> 
       <th width="15%">Temperature</td> 
       <th width="15%">Freshtime Points</td> 
       <th width="15%"><div class="switch switch-square" data-on-label="<i class='fui-check'></i>" data-off-label="<i class='fui-cross'></i>"><input type="checkbox" id="colorBar-Toggle"/></div></td> 
      </tr> 
     </thead> 
      <tbody>...</tbody> 
     </script> 

пожалуйста, может кто-нибудь помочь мне это очень ВАЖНАЯ для меня.

+0

Где код рули? Разметка заметно отличается ... – Nix

+0

@Nix Я добавил код руля, вы можете мне помочь. Я новичок в этом. – user2873816

ответ

0

Привет, ребята, я основал после повторного шаблона, если я вызываю следующую функцию, он работает отлично. Но после вызова функции другой toggle также работает. Я нашел следующую функцию в файле bootstrap-switch.js.

Не знаю, почему другие переключатели действуют. Еще один новый переключатель toggle добавляет div. потому что я получаю дополнительную обивку вокруг главного переключателя.

другой код Переключить в:

<div class="switch switch-square has-switch" data-on-label="2" data-off-label="1"><div class="switch-animate switch-off switch-on"><div class="switch-animate"><div class="switch-on switch-animate"><div class="switch-animate"><div class="switch-animate"><div class="switch-animate"><div class="switch-animate"><input type="checkbox" id="qtenToggle"><span class="switch-left">2</span><label for="qtenToggle">&nbsp;</label><span class="switch-right">1</span></div><span class="switch-left">2</span><label for="qtenToggle">&nbsp;</label><span class="switch-right">1</span></div><span class="switch-left">2</span><label for="qtenToggle">&nbsp;</label><span class="switch-right">1</span></div><span class="switch-left">2</span><label for="qtenToggle">&nbsp;</label><span class="switch-right">1</span></div><span class="switch-left">2</span><label for="qtenToggle">&nbsp;</label><span class="switch-right">1</span></div><span class="switch-left">2</span><label for="qtenToggle">&nbsp;</label><span class="switch-right">1</span></div><span class="switch-left">2</span><label for="qtenToggle">&nbsp;</label><span class="switch-right">1</span></div></div> 

самозагрузки функция:

$('.switch')['bootstrapSwitch'](); 
Смежные вопросы