天翎MyApps技术社区 - 低代码平台 | 流程管理系统 | BPM软件

 找回密码
 注册成为天翎用户
查看: 1529|回复: 0

[源码] 左右选择框如何根据选项数目动态调整高度?【源码-左右选择框】

[复制链接]
echochen 发表于 2013-10-15 14:34:40 | 显示全部楼层 |阅读模式
Q: 左右选择框如何根据选项数目动态调整高度?
A:您好,您可以在图中插入以下代码:
111111111.jpg
  1. var thisSec = $(this).parent().parent();
  2. var a = new Array();
  3. for(i=0;i<2;i++){
  4.         var op_len = thisSec.find(".ms2side__select").eq(i).find("select").children().length;
  5.         var fontSize = thisSec.find(".ms2side__select").eq(i).find("select").css("font-size");
  6.         var index_p = fontSize.indexOf("px");
  7.         var h_p = fontSize.substring(0,index_p);
  8.         var sel_H = op_len * (parseInt(h_p) + 4);
  9.         a[i] = sel_H;
  10.         if(i == 1){
  11.                 var H = a[0]>a[1]?a[0]:a[1];
  12.                 thisSec.find(".ms2side__select").find("select").height(H);
  13.         }
  14. }
复制代码
前台效果:
22222222222.jpg

对应问题的链接:http://www.teemlink.com/bbs/view ... mp;extra=#pid240017

本版积分规则

QQ|手机版|天翎MyApps技术社区 ( 粤ICP备11093750号 )

GMT+8, 2026-8-12 16:35

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表