简体   繁体   English

选择框高度不适用于Chrome

[英]select box height is not working in chrome

3 radio buttons and a single select box on the page. 页面上的3个单选按钮和一个选择框。 clicking on first radio button then in select box it will show contents related to first radio button ,respectively...selecting first radio button its working fine ,when i am selecting second radio button ,the select box height is decreasing ,cant able to visible at all ,third also same ,its happening in chrome ,FF its working fine 单击第一个单选按钮,然后在选择框中将显示与第一个单选按钮相关的内容,分别...选择第一个单选按钮,其工作正常,当我选择第二个单选按钮时,选择框的高度正在减小,无法看到完全一样,第三个也一样,它发生在chrome中,但其工作正常

my code 我的密码

 <label><input type="radio" name="reward-venue" value="Fly" checked /><div class="radio-icon Fly-sprite"></div></label>
    <label><input type="radio" name="reward-venue" value="Drive" /><div class="radio-icon Drive-sprite"></div></label> 
    <label><input type="radio" name="reward-venue" value="Stay" /><div class="radio-icon Stay-sprite"></div></label> 



 <div>
    Reward program
      <select name="program">
        <option value=""> - select one - </option>
        {{#fly_programs}}
        <optgroup label="Fly">
          {{#reward_program}}
          <option value="{{reward_program_id}}">{{name}}</option>
          {{/reward_program}}
        </optgroup>
        {{/fly_programs}}
        {{#drive_programs}}
        <optgroup label="Drive">
          {{#reward_program}}
          <option value="{{reward_program_id}}">{{name}}</option>
          {{/reward_program}}
        </optgroup>
        {{/drive_programs}}
        {{#stay_programs}}
        <optgroup label="Stay">
          {{#reward_program}}
          <option value="{{reward_program_id}}">{{name}}</option>
          {{/reward_program}}
        </optgroup>
        {{/stay_programs}}
      </select>
  </div>

js for hiding and showing 用于隐藏和显示的js

  var show_optgroup = $('optgroup[label=' + venue_name + ']')
    , hide_optgroup = $('optgroup[label!=' + venue_name + ']')
    ;

    show_optgroup.show();
    show_optgroup.children('option').show();
    hide_optgroup.hide();
    hide_optgroup.children('option').hide();

    this.$el.find('option:selected').removeAttr('selected');
    this.$el.find('option:first').attr('selected', 'selected');
    $.uniform.update();
    return this;
  },

Could something like this work? 这样的事情行得通吗?

$('[name="reward-venue"]').click(function(){
    $('optgroup[label!='+$(this).val()+']').hide();
    $('optgroup[label!='+$(this).val()+']').children('option').hide();  
    $('optgroup[label='+$(this).val()+']').show();
    $('optgroup[label='+$(this).val()+']').children('option').show();
    $('[name="program"]')[0].selectedIndex=0;
});​

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM