javascript - After webpack packages css, it causes js error.
我想大声告诉你
我想大声告诉你 2017-05-19 10:13:49
0
2
634

When I introducecssseparately into html, the width calculated byjsis normal, but when I introducecss,jsWhen packaged together, the calculated width ofjshas changed. I’m really confused? ? ?

2376px
When thecssfile is imported separately, this is the normal width.

This is the width ofcssandjspackaged together.

This directly caused the seamless scrolling I wrote to fail.


This is the width calculation in js.

Why does it have an impact? I don’t understand. Can you please explain? ? ? ! ! !

我想大声告诉你
我想大声告诉你

reply all (2)
阿神

When webpack packages css, it puts the css into js. When the front-end js is executed, the css will be inserted into the html, so it is best to introduce css at the entrance of the js code, so that when js is executed, the css will be inserted first, and then Get the size and it’s correct

    phpcn_u1582

    It’s because of the packaging order, css should be packaged first.

      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!