首頁 web前端 html教學 在chrome下不能显示displayblock或者inlineblock的元素怎么办?

在chrome下不能显示displayblock或者inlineblock的元素怎么办?

Jun 06, 2017 am 09:24 AM

在chrome下不能正常显示一个display: inline-block或者display: block的元素怎么办 
 DEMO页面只有一个输入框,当输入框有焦点时高度变大,并且显示 字数显示和回复按钮。 
 现在问题是,chrome只能在第一次刷新之后点击输入框然后高度变大并显示 字数显示和回复按钮的元素,但是再点击第二次输入框就只有高度变大,却没有看到字数显示和回复按钮的元素了(firefox正常) 

<head>
<meta charset="UTF-8">
<title>案例:人人网评论功能</title>
<style>.comment-input{width: 450px;}.input-area{outline: 0;border: 1px solid black;width:446px;height: 15px;}.input-area_expand{height: 45px;}.input-action{display: none;}.input-action_show{height: 26px;width: 102px;display: inline-block;
//这里display: block都试过了,只能在第一次刷新的时候看到,再点击第二次输入框就看不到了float: right;}
</style></head><body><p class="comment-input" style="border:1px solid red">
<textarea class="input-area"   >
评论……</textarea><p class="input-action" style="border:1px solid red"><span class="inputed">0</span>/<span class="maxlength">140</span><a href="javascript:void(0)" class="reply-btn">回复</a></p></p></body>
//获取下一个兄弟元素节点function getNextElement(node)
{      if(node.nodeType == 1){          return node;      }      
if(node.nextSibling){          return getNextElement(node.nextSibling);      }      
return false;}   document.getElementsByClassName(&#39;input-area&#39;)[0].onfocus = function() 
{this.className = &#39;input-area input-area_expand&#39;var nextEl = getNextElement(this.nextSibling);
nextEl.className = &#39;input-action input-action_show&#39;;this.value = &#39;&#39;;
console.log(&#39;focus:&#39;+nextEl.className)}document.getElementsByClassName(&#39;input-area&#39;)[0].onblur = function() {var nextEl = getNextElement(this.nextSibling);nextEl.className = &#39;input-action&#39;;this.className = &#39;input-area&#39;this.value = &#39;评论……&#39;;console.log(&#39;blur :&#39;+nextEl.className);}

以上就是在chrome下不能显示displayblock或者inlineblock的元素怎么办?,更多请关注php中文网其它相关文章!

本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Stock Market GPT

Stock Market GPT

人工智慧支援投資研究,做出更明智的決策

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

熱門話題

修復Google Chrome中的內存洩漏問題 修復Google Chrome中的內存洩漏問題 Aug 29, 2025 am 07:20 AM

IfChromeusestoomuchmemoryorrunsslowly,trythesesteps:1.UseShift EsctoopenTaskManagerandendhigh-memorytabsorextensions.2.Disableorremoveproblematicextensions.3.Enablehardwareaccelerationinsettings.4.UpdateChrometothelatestversion.5.ResetChromesettingst

如何修復Google Chrome中的'無法正確打開您的個人資料”錯誤 如何修復Google Chrome中的'無法正確打開您的個人資料”錯誤 Aug 30, 2025 am 08:11 AM

IfChromeshows"Yourprofilecouldnotbeopenedcorrectly,"trythesesteps:1.RestartChrome.2.DeletetheSingletonLockfileinUserData.3.RenametheDefaultfoldertoDefault_Backup.4.LaunchChromewith--disable-extensions.5.Createanewuserprofile.6.ReinstallChro

如何在Google Chrome中修復與WebGL相關的錯誤? 如何在Google Chrome中修復與WebGL相關的錯誤? Aug 27, 2025 am 12:56 AM

EnsurehardwareaccelerationisenabledinChromesettingsandenable"Overridesoftwarerenderinglist"inchrome://flags,thenrestartthebrowser.2.UpdateorreinstallyourgraphicsdriversviaDeviceManageronWindowsorsystemupdatesonMac.3.Disableconflictingextens

如何在筆記本電腦上使用過多的電源來修復鉻 如何在筆記本電腦上使用過多的電源來修復鉻 Aug 29, 2025 am 01:25 AM

關閉多餘擴展、限制後台活動、調整硬件加速設置可降低Chrome耗電量。首先關閉不必要擴展,進入chrome://extensions/禁用或卸載資源佔用高的插件;其次在系統設置中開啟“限制後台擴展程序活動”並使用插件掛起不活躍標籤頁;最後根據設備情況嘗試關閉硬件加速以減少GPU負載,若效果良好則可長期保持該設置。

如何管理Google Chrome中的站點權限 如何管理Google Chrome中的站點權限 Aug 27, 2025 am 12:04 AM

TomanageWebsitePermmissingOogLechrome:1.Gotosettings>私密和security> siteSettings.2.Controlaccessforcamera,location and.3.allow,block,block,block,orresetpermissionsforspecificsites.4.useincognitomodemodemodemodemoderempolocorary cristructer rucding rucdiders browsing。

如何阻止Google Chrome分組選項卡? 如何阻止Google Chrome分組選項卡? Sep 17, 2025 am 01:47 AM

disableTabGroupsByVisitingChrome:// flags,搜索“ tabGroups”,settreal flagstodisabled,andrestartingChrome.2.ManalyGrouTabsbySbyDraggingTheMoutofthemofthemofthemofthemofthegroup,threthertherthertherthertheright-clickungrouption,orassigningingingingingingIndingIndividualTabStonogroup.3.avoidAigroup.3.avoidaigoida.3.avoida.3.avoida.3.avoida.3.avoida.3.avoidaa

如何更改Chrome的下載位置 如何更改Chrome的下載位置 Sep 17, 2025 am 02:59 AM

TochangeChrome'SdownLoadLocation,GotoSettings>私有服務>下載,thenclick“更改” tosetanewfolder.ternestelationalsy,啟用“ AskWheretoSave” toChooseeachTime.quicklyAccessSettingssettingsbyTypytyptyptyptyptyControme:// settings/nettings/settings/settings/settings/settsInthead

當Google Chrome打開時,為什麼我的相機照明? 當Google Chrome打開時,為什麼我的相機照明? Sep 23, 2025 am 12:31 AM

ThecameralightturnsoninChromebecauseawebsiteorappisactivelyaccessingyourcamera,evenifyou'reunaware.2.Commonreasonsincludevideocalls,livepreviews,facefilters,orsecurityverification.3.Tocheckwhichsiteisusingthecamera,lookforacameraiconorlocksymbolinthe

See all articles