下面的Javascript(当另一个元素滚动到视图中时,触发元素的分页背景颜色)在Internet Explorer中不起作用,但在所有其他浏览器中均不起作用。有谁知道为什么吗?
我的笔中也提供了代码基础:https://codepen.io/headstarterz/pen/PMdZdV/
--create test table with sample data
CREATE TABLE dbo.YourTable(
requisitionid int PRIMARY KEY
);
WITH
t10 AS (SELECT n FROM (VALUES(0),(0),(0),(0),(0),(0),(0),(0),(0),(0)) t(n))
,t1000 AS (SELECT ROW_NUMBER() OVER (ORDER BY (SELECT 0)) AS num FROM t10 AS a CROSS JOIN t10 AS b CROSS JOIN t10 AS c)
INSERT INTO dbo.YourTable WITH(TABLOCKX)
SELECT num
FROM t1000
WHERE num <= 800;
GO
--query for first page (page 1) on descending key (returns 800-791)
SELECT TOP(10) requisitionid
FROM YourTable
ORDER BY requisitionid DESC;
GO
--query for next page (page 2) on descending key (returns 790-781)
DECLARE @LastRequisitionIdOnPage int = 791;
SELECT TOP(10) requisitionid
FROM YourTable
WHERE requisitionid < @LastRequisitionIdOnPage
ORDER BY requisitionid DESC;
GO
--query for previous page (page 1) on descending key (returns 800-791)
DECLARE @FirstRequisitionIdOnPage int = 790;
SELECT requisitionid
FROM (
SELECT TOP(10) requisitionid
FROM YourTable
WHERE requisitionid > @FirstRequisitionIdOnPage
ORDER BY requisitionid ASC
) AS prev_page
ORDER BY requisitionid DESC;;
GO
脚本可在Chrome,Safari,Firefox,Edge
中使用脚本在Internet Explorer 11中不起作用
答案 0 :(得分:0)
这可能是两个原因:
首先,您的<script>
结束标记拼写错误(<skript>
)。
此外,您使用的是“胖箭头功能”,这是ES6的功能。我会研究像Babel这样的东西来将您的代码转换为I.E.友好的语法