一、移動(dòng)端相關(guān)問(wèn)題

1.移動(dòng)端禁止遮罩層下面的頁(yè)面滑動(dòng)

答:打開(kāi)遮罩層的時(shí)候,給遮罩層下面的頁(yè)面添加position:fixed屬性,頁(yè)面就是固定的,沒(méi)辦法滑動(dòng)了。遮罩層消失之后,下面的頁(yè)面去掉position:fixed屬性即可。(可通過(guò)控制類名的方式)

2.移動(dòng)端點(diǎn)透問(wèn)題

答:阻止冒泡(event.stopPropagation());

3.鍵盤(pán)將input框頂上去

解決思路:可以采用動(dòng)態(tài)獲取底部footer的offset().top 再減去其父元素offset().top ,將其差值當(dāng)作footer的的margin-top數(shù)值的,同時(shí)remove掉footer的fixed屬性。

function offsetTop(elements) {

? ? ? ? ? ? var top = elements.offsetTop;

? ? ? ? ? ? var parent = elements.offsetParent;

? ? ? ? ? ? while (parent != null) {

? ? ? ? ? ? ? ? top += parent.offsetTop;

? ? ? ? ? ? ? ? parent = parent.offsetParent;

? ? ? ? ? ? }

? ? ? ? ? ? return top;

? ? ? ? }

? ? ? ? var offtop = offsetTop($(".setting_btn_clear")[0]) - offsetTop($(".setting_btn")[0]) - 60;

? ? ? ? if (offtop > 0) {

? ? ? ? ? ? $(".setting_btn").css({"textAlign": "center"});

? ? ? ? ? ? $(".setting_remenber").css({"position": "static", "marginTop": (offtop - 30), "textAlign": "center"});

? ? ? ? ? ? $(".setting_btn_clear").css({"position": "static"});

? ? ? ? ? ? $(".setting_btn_sure").css({"position": "static", "marginLeft": "20px"});

? ? ? ? }

4.點(diǎn)擊使用tap事件,可以解決click的延遲問(wèn)題;



5.底部border的1像素問(wèn)題和去掉border的問(wèn)題 (stylus)

border-1px($color)

? position: relative

? &:after

? ? display: block

? ? position: absolute

? ? left: 0

? ? bottom: 0

? ? width: 100%

? ? border-top: 1px solid $color

? ? content: ' '

--------------------------------

border-none()

? &:after

? ? display: none

6.設(shè)置背景圖片(stylus)

bg-image($url)

? background-image: url($url + "@2x.png")

? @media (-webkit-min-device-pixel-ratio: 3),(min-device-pixel-ratio: 3)

? ? background-image: url($url + "@3x.png")

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容