Changing a data attribute in Safari, but the screen does not redraw to new CSS style [closed]

帅比萌擦擦* 提交于 2019-12-11 02:21:11

问题


In my website I have created a content and navigation element.

Once the 'Next' button is clicked my Javascript will interpret the next page and change a 'data-progress' attribute on it's parent node. My CSS contains several selectors

.content[data-progress="0"] > .progressNavigationHolder > .progressNavigation > div:nth-child(1)

and

.content[data-progress="0"] > .progressPages > ul

so that the tab changes to a pressed state, and the page's margin-left will be incremented by 480px.

This all works great (if a bit confusing to write and explain), whereby the code will change the data-progress to the incremented value as well as the CSS selectors link to the correct node. However, this is only true as far as the inspector is concerned, but in reality, the screen/viewport is not updated to show this change.

This works great in Chrome but for some reason Safari does not want to show it.

If it is any help I am running Safari 5.1.7 on Windows.


回答1:


Ok, so to overcome this issue, I changed a class of a tag in my Javascript. It seems to be force redrawing the screen.



来源:https://stackoverflow.com/questions/10934043/changing-a-data-attribute-in-safari-but-the-screen-does-not-redraw-to-new-css-s

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!