找回密码
 快速注册
搜索
查看: 69|回复: 10

手机版<details>无法展开

[复制链接]

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

hbghlyj 发表于 2023-5-7 03:41 |阅读模式
手机版<details>无法展开
检查发现被#mask元素挡住

1楼details
test1

730

主题

1万

回帖

9万

积分

积分
93618
QQ

显示全部楼层

kuing 发表于 2023-5-7 15:30
解决了。(副作用未知)

由我想到
为什么只挡住了 details ,而像 tikz 或 asy 那些点击看代码的又不会影响呢?
起,我就意识到这和楼主认为的 z-index 应该无关。
最终发现是 \static\js\mobile\common.js 第 682 行(即 5# 第二段代码的 20 行)的一句:
return false;
阻止了默认行为的执行,把这行注释掉就好了。

15

主题

958

回帖

1万

积分

积分
12454

显示全部楼层

色k 发表于 2023-5-7 08:02 来自手机
那怎么解决?

2楼details
test2

点评

和CSS z-index有关?  发表于 2023-5-7 08:13

730

主题

1万

回帖

9万

积分

积分
93618
QQ

显示全部楼层

kuing 发表于 2023-5-7 09:25
在手机版,进入帖子时就存在以下 div:
<div id="mask" style="display:none;"></div>
这时无影响,但只要点击 2 楼以上的任意位置它就会变成
<div id="mask" style="display: block; width: 100%; height: 100%; position: fixed; top: 0px; left: 0px; background: transparent; z-index: 100;"></div>
它是用来干啥的?起到什么作用?

如果再点回 1 楼,又会变回 display:none;
据此,只有 2 楼以上的 <details> 才会展不开,为测试,编辑了一下 1、2 楼,果然如此。

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2023-5-7 09:27
kuing 发表于 2023-5-7 02:25
z-index: 100;"></div>
它是用来干啥的?起到什么作用?


我只知道,当元素之间重叠的时候,z-index 较大的元素会覆盖较小的元素在上层进行显示。

点评

我也知道,我只是好奇这块的作用是什么  发表于 2023-5-7 09:27

730

主题

1万

回帖

9万

积分

积分
93618
QQ

显示全部楼层

kuing 发表于 2023-5-7 09:38
应该跟以下两段代码有关:
\static\js\mobile\common.js 第 546-600 行:
  1. var POPMENU = new Object;
  2. var popup = {
  3.         init : function() {
  4.                 var $this = this;
  5.                 $('.popup').each(function(index, obj) {
  6.                         obj = $(obj);
  7.                         var pop = $(obj.attr('href'));
  8.                         if(pop && pop.attr('popup')) {
  9.                                 pop.css({'display':'none'});
  10.                                 obj.on('click', function(e) {
  11.                                         $this.open(pop);
  12.                                 });
  13.                         }
  14.                 });
  15.                 this.maskinit();
  16.         },
  17.         maskinit : function() {
  18.                 var $this = this;
  19.                 $('#mask').off().on('tap', function() {
  20.                         $this.close();
  21.                 });
  22.         },
  23.         open : function(pop, type, url) {
  24.                 this.close();
  25.                 this.maskinit();
  26.                 if(typeof pop == 'string') {
  27.                         $('#ntcmsg').remove();
  28.                         if(type == 'alert') {
  29.                                 pop = '<div class="tip"><dt>'+ pop +'</dt><dd><input class="button2" type="button" value="确定" onclick="popup.close();"></dd></div>'
  30.                         } else if(type == 'confirm') {
  31.                                 pop = '<div class="tip"><dt>'+ pop +'</dt><dd><input class="redirect button2" type="button" value="确定" href="'+ url +'"><a href="javascript:;" onclick="popup.close();">取消</a></dd></div>'
  32.                         }
  33.                         $('body').append('<div id="ntcmsg" style="display:none;">'+ pop +'</div>');
  34.                         pop = $('#ntcmsg');
  35.                 }
  36.                 if(POPMENU[pop.attr('id')]) {
  37.                         $('#' + pop.attr('id') + '_popmenu').html(pop.html()).css({'height':pop.height()+'px', 'width':pop.width()+'px'});
  38.                 } else {
  39.                         pop.parent().append('<div class="dialogbox" id="'+ pop.attr('id') +'_popmenu" style="height:'+ pop.height() +'px;width:'+ pop.width() +'px;">'+ pop.html() +'</div>');
  40.                 }
  41.                 var popupobj = $('#' + pop.attr('id') + '_popmenu');
  42.                 var left = (window.innerWidth - popupobj.width()) / 2;
  43.                 var top = (document.documentElement.clientHeight - popupobj.height()) / 2;
  44.                 popupobj.css({'display':'block','position':'fixed','left':left,'top':top,'z-index':120,'opacity':1});
  45.                 $('#mask').css({'display':'block','width':'100%','height':'100%','position':'fixed','top':'0','left':'0','background':'black','opacity':'0.2','z-index':'100'});
  46.                 POPMENU[pop.attr('id')] = pop;
  47.         },
  48.         close : function() {
  49.                 $('#mask').css('display', 'none');
  50.                 $.each(POPMENU, function(index, obj) {
  51.                         $('#' + index + '_popmenu').css('display','none');
  52.                 });
  53.         }
  54. };
复制代码

第 663-700 行:
  1. var DISMENU = new Object;
  2. var display = {
  3.         init : function() {
  4.                 var $this = this;
  5.                 $('.display').each(function(index, obj) {
  6.                         obj = $(obj);
  7.                         var dis = $(obj.attr('href'));
  8.                         if(dis && dis.attr('display')) {
  9.                                 dis.css({'display':'none'});
  10.                                 dis.css({'z-index':'102'});
  11.                                 DISMENU[dis.attr('id')] = dis;
  12.                                 obj.on('click', function(e) {
  13.                                         if(in_array(e.target.tagName, ['A', 'IMG', 'INPUT'])) return;
  14.                                         $this.maskinit();
  15.                                         if(dis.attr('display') == 'true') {
  16.                                                 dis.css('display', 'block');
  17.                                                 dis.attr('display', 'false');
  18.                                                 $('#mask').css({'display':'block','width':'100%','height':'100%','position':'fixed','top':'0','left':'0','background':'transparent','z-index':'100'});
  19.                                         }
  20.                                         return false;
  21.                                 });
  22.                         }
  23.                 });
  24.         },
  25.         maskinit : function() {
  26.                 var $this = this;
  27.                 $('#mask').off().on('touchstart', function() {
  28.                         $this.hide();
  29.                 });
  30.         },
  31.         hide : function() {
  32.                 $('#mask').css('display', 'none');
  33.                 $.each(DISMENU, function(index, obj) {
  34.                         obj.css('display', 'none');
  35.                         obj.attr('display', 'true');
  36.                 });
  37.         }
  38. };
复制代码

730

主题

1万

回帖

9万

积分

积分
93618
QQ

显示全部楼层

kuing 发表于 2023-5-7 09:43
但是在改之前,还是应该先理解这块到底起了什么作用,不然就无法预知改后会出现什么副作用了(我平时也不用手机版,所以很难知道)

还有为什么只挡住了 details ,而像 tikz 或 asy 那些点击看代码的又不会影响呢?

730

主题

1万

回帖

9万

积分

积分
93618
QQ

显示全部楼层

kuing 发表于 2023-5-7 15:46
另外无意中发现,手机版的 verhash 在后台更新缓存后就会变,太好了,不像电脑版那样永远不变(除非手工改数据库)

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2023-10-26 17:11
致各位论坛网友:

由于 hbghlyj 操作数据库失误导致由 2023-9-26 至 2023-11-5 间期的所有帖子的内文都被清空,在此给大家真诚道歉。

现在我们正在浏览这期间的帖子,努力回忆内容,尽可能地多恢复一些,如果您还记得本帖原本的内容,也希望您能编辑回来,麻烦各位了。

手机版|悠闲数学娱乐论坛(第3版)

GMT+8, 2025-3-4 15:52

Powered by Discuz!

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