问题标签 [document-body]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
php - 使用 PHP 将实时 ID 添加到 BODY
我正在使用 php 代码:
和
它工作得很好——在正文 ID 中将 index.php?help 切割为“帮助”,将 index.php?start 切割为“start”。但是当我在正文中输入 index.php 时,ID 是“index”而不是“start”。有没有办法告诉 index.php 包含 start.php 显示“开始”id body ID?
更新
它应该动态工作 - 正文 ID 是包含的 .php 文件的名称,类似于以下代码:
jquery - scrollTop() 在 Firefox 中返回 0,但在 Chrome 中不返回
不确定是否还有其他问题,如果是这样,我道歉,请不要释放猎犬。
使用 html5 文档类型并在我的滚动侦听器中快速执行 console.log,它告诉我 scrollTop() 值的值。我基本上是这样做的,所以当我滚动过去一个点时,我会改变一个元素的不透明度。我正在使用 MVS 解决方案执行此操作,但我无法将其推送到外部站点,以便您查看。这是一个快速的片段:
如果我在 Chrome 中滚动,我会得到一个 console.log(scrollTop); 显示我想要的(即;每次滚动 100 次),当我达到 200 次滚动顶部后,我的不透明度消失了。如果我在 FF 和 IE7+ 中滚动,则每次滚动时 var 都会返回“0”。如果我将 $('body').scrollTop() 更改为 $('document').scrollTop(); 然后我在滚动时得到一个“null”返回。
有任何想法吗?谢谢!