在调整大小时将滚动条添加到fancybox

时间:2017-10-16 18:49:36

标签: javascript jquery fancybox

我有一个弹出窗体,我使用以下代码向Fancybox 2演示:

$(link).fancybox({
    type: 'iFrame',
    autoSize: false,
    autoScale: false,
    width: '1280px',
    height: '1024px',
    iFrame: {
        scrolling: 'auto'
    }
});

表单有几个下拉框,我使用选择的jQuery插件进行样式设置。由于它们是多重选择,因此它们最终会调整页面大小并将内容从底部推出。我希望,当内容调整大小时,在fancybox上显示一个垂直滚动条。我已经尝试将iFrame滚动设置为自动,也设置为是,但没有结果。我还添加了一个滚动属性,超出了iFrame属性,但也没有帮助。有人能告诉我如何做到这一点吗?

2 个答案:

答案 0 :(得分:0)

看起来你有拼写错误选项public static class Extensions { public static HashSet<Type> NumericTypes = new HashSet<Type>() { typeof(byte), typeof(sbyte), typeof(ushort), typeof(uint), typeof(ulong), typeof(short), typeof(int), typeof(long), typeof(decimal), typeof(double), typeof(float) }; public static bool IsNumeric1(this object o) => NumericTypes.Contains(o.GetType()); public static bool IsNumeric2(this object o) => o is byte || o is sbyte || o is ushort || o is uint || o is ulong || o is short || o is int || o is long || o is decimal || o is double || o is float; public static bool IsNumeric3(this object o) { switch (o) { case Byte b: case SByte sb: case UInt16 u16: case UInt32 u32: case UInt64 u64: case Int16 i16: case Int32 i32: case Int64 i64: case Decimal m: case Double d: case Single f: return true; default: return false; } } public static bool IsNumeric4(this object o) { switch (Type.GetTypeCode(o.GetType())) { case TypeCode.Byte: case TypeCode.SByte: case TypeCode.UInt16: case TypeCode.UInt32: case TypeCode.UInt64: case TypeCode.Int16: case TypeCode.Int32: case TypeCode.Int64: case TypeCode.Decimal: case TypeCode.Double: case TypeCode.Single: return true; default: return false; } } } class Program { static void Main(string[] args) { var count = 100000000; //warm up calls for (var i = 0; i < count; i++) { i.IsNumeric1(); } for (var i = 0; i < count; i++) { i.IsNumeric2(); } for (var i = 0; i < count; i++) { i.IsNumeric3(); } for (var i = 0; i < count; i++) { i.IsNumeric4(); } //Tests begin here var sw = new Stopwatch(); sw.Restart(); for (var i = 0; i < count; i++) { i.IsNumeric1(); } sw.Stop(); Debug.WriteLine(sw.ElapsedMilliseconds); sw.Restart(); for (var i = 0; i < count; i++) { i.IsNumeric2(); } sw.Stop(); Debug.WriteLine(sw.ElapsedMilliseconds); sw.Restart(); for (var i = 0; i < count; i++) { i.IsNumeric3(); } sw.Stop(); Debug.WriteLine(sw.ElapsedMilliseconds); sw.Restart(); for (var i = 0; i < count; i++) { i.IsNumeric4(); } sw.Stop(); Debug.WriteLine(sw.ElapsedMilliseconds); } ,它应该是iFrame

答案 1 :(得分:0)

嗯,答案最终与Fancybox没有任何关系。有人添加了溢出:隐藏到样式表中的html和body元素。我不知道背后的原因是什么,但我会发现。

顺便说一句,如果downvoters会发表评论会很好。提出一个合理的问题会让人感到有点沮丧,并且没有明显的理由而被投票。如果我需要更好的问题,请告诉我。这肯定是我学习的唯一方式。