我在Safari 11.0.3中测试
网站:https://3milychu.github.io/met-erials
我有以下功能来创建一个标题,在滚动时弹出所选项目
function scrollState () {
var elmnt = document.getElementById("title");
var rep = elmnt.offsetTop;
if (window.pageYOffset >= elmnt.offsetHeight) {
// $('input:not(:checked').parent().hide();
$('input:not(:checked').parent().css("display","none");
$("input:checked").css("display", "inline");
$("label").css("marginLeft", "35%");
$("label" ).css("fontSize", "4em");
$("label" ).css("textAlign", "center");
$("input:checked").css("float", "none");
$("input:checked").css("verticalAlign", "top");
$("input[type=radio]").css("width", "3em");
$("input[type=radio]").css("height", "3em");
$("input:checked").css("fontSize", "0.5em");
} else {
$("input:checked").css("display", "inline")
$("label").css("marginLeft", "0%");
$("label" ).css("textAlign", "none");
$("input:checked").css("float", "right");
$("input[type=radio]").css("width", "2em");
$("input[type=radio]").css("height", "2em");
$("input:checked").css("fontSize", "11px");
// $('input:not(:checked').parent().show();
$('input:not(:checked').parent().css("display","inline-block");
$("label").css("fontSize", "1.5em");
};
};
我叫它:
window.onscroll = function() {scrollState()};
为什么这在Safari中不起作用?在看到Safari需要将其替换为.css("显示","无")后,我注释掉了.hide()方法。
这可以根据需要在Chrome和Firefox中使用(当您使用.hide()和.show()方法时)
答案 0 :(得分:1)
您的$('input:not(:checked').parent().css("display","none");
(取代.show()
的那个)需要('display', 'inline-block')
?您希望元素显示,但您正在编写('display', 'none')
答案 1 :(得分:1)
语法错误。
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using iTextSharp.text;
using iTextSharp.text.pdf;
namespace TiffToPDFApplication
{
public class UsingiTextSharp
{
/// <summary>
///
/// </summary>
/// <param name="path"></param>
public string TiffToPdfConverter(string path, string targetLoc, string fileName)
{
string fileNameWithLoc = String.Empty;
string fileNameWithLoc2 = String.Empty;
if (fileName == String.Empty)
{
string[] pathArr = path.Split('\\');
string[] fileArr = pathArr.Last().Split('.');
fileName = fileArr[0];
}
fileName = fileName + ".pdf";
if (File.Exists(path))
{
try
{
FileStream fileStream = File.OpenRead(path);
byte[] tiffByteArray = new byte[fileStream.Length];
fileStream.Read(tiffByteArray, 0, tiffByteArray.Length);
fileStream.Close();
convertImage(tiffByteArray);
// Convert to PDF Byte Array
byte[] pdfbyteArray = ConvertToPDFArray(tiffByteArray);
//FileName and Location
fileNameWithLoc = targetLoc + "\\" + fileName;
// Writing File to the Local Location
using (Stream file = File.OpenWrite(fileNameWithLoc))
{
file.Write(pdfbyteArray, 0, pdfbyteArray.Length);
}
}
catch(Exception ex)
{
throw ex;
}
}
return fileNameWithLoc;
}
/// <summary>
///
/// </summary>
/// <param name="inboundFaxBytes"></param>
/// <returns></returns>
public static byte[] ConvertToPDFArray(byte[] inboundFaxBytes)
{
byte[] imagePdfBytes = null;
try
{
using (MemoryStream ms = new MemoryStream())
{
Bitmap faxDocBitmap;
ms.Write(inboundFaxBytes, 0, inboundFaxBytes.Length);
faxDocBitmap = new Bitmap(ms);
iTextSharp.text.Document document = new iTextSharp.text.Document(PageSize.A4, 50, 50, 50, 50);
iTextSharp.text.pdf.PdfWriter writer = iTextSharp.text.pdf.PdfWriter.GetInstance(document, ms);
int totalPages = faxDocBitmap.GetFrameCount(System.Drawing.Imaging.FrameDimension.Page);
//document.SetPageSize(PageSize.A4);
document.Open();
PdfContentByte cb = writer.DirectContent;
for (int page = 0; page < totalPages; ++page)
{
faxDocBitmap.SelectActiveFrame(System.Drawing.Imaging.FrameDimension.Page, page);
iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(faxDocBitmap, System.Drawing.Imaging.ImageFormat.Bmp);
img.ScalePercent(72f / img.DpiX * 100, 72f / img.DpiY * 100);
img.SetAbsolutePosition(0, 0);
// Memory Stream is not expandable
cb.AddImage(img);
document.NewPage();
}
document.Close();
imagePdfBytes = ms.ToArray();
ms.Dispose();
}
}
catch (Exception e)
{
throw e;
}
return imagePdfBytes;
}
}
}
应该是
$('input:not(:checked').parent().css("display","inline-block");
这解决了这个问题。