The dom of jq's ajax append has no style after using the TouchSlide plug-in

jq"s ajax append after using the TouchSlide plug-in causes the class defined by TouchSlide to have no style

now it"s like this clipboard.png


clipboard.png

width0px
bdclass

ajax
clipboard.png

clipboard.png

Mar.02,2021

clipboard.png

two scenarios
scenario one
do not need $('.bd') .append (html)
add dom with the append method of the generated TouchSlider object (dom is not html)
scenario two
$('.bd') .append (html)
then call the refresh method of the TouchSlider object


has not used TouchSlide. However, this is generally due to the fact that the later inserted HTML is not inserted into the DOM, so there is no width or height when it is taken out, so width:0px . The solution can be added to the Slide by calling JS after the entire HTML is rendered, that is, using setTimeout to operate on the next stack.

addHTML();
setTimeout(addToSlide, 0);
Menu