Qualtrics中JS嵌入HTML文本格式与默认文本不一致的问题求助
Qualtrics中JS嵌入HTML文本格式与默认文本不一致的问题求助
我想在Qualtrics的多个页面、多个问题上方固定显示同一个表格,于是参考了相关代码指引,在问题里添加了如下JavaScript代码:
Qualtrics.SurveyEngine.addOnReady(function() { /*Place your JavaScript here to run when the page is fully displayed*/ var base_element = document.querySelector(".QuestionOuter"); base_element.insertAdjacentHTML('afterbegin', '<div id="sticky_vid" style="position: sticky; top:0;" align="middle">'); var new_element = document.querySelector("#sticky_vid"); // Change the text below to add the element of your choice new_element.innerHTML = `Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<br /> &nbsp; <br /> <table border="1" cellpadding="1" cellspacing="1" style="width:1000px;"> <thead> <tr> <th scope="col">Some text</th> <th scope="col">&nbsp;Project A</th> <th scope="col">Project B (some more info)</th> </tr> </thead> <tbody> <tr> <th scope="row">More text</th> <td>Lorem ipsum dolor sit amet, consectetur adipiscing elit</td> <td>ELorem ipsum dolor sit amet, consectetur</td> </tr> <tr> <th scope="row">Lorep 1</th> <td>Lorem ipsum dolor sit amet, consectetur</td> <td>orem ipsum dolor sit amet, consectetur</td> </tr> <tr> <th scope="row">Even more text&nbsp;</th> <td>Required behavioral<br /> adoption</td> <td>Encroaching on the land&nbsp;and rights of local communities, labour right violations</td> </tr> <tr> <th scope="row">Some numbers</th> <td>32</td> <td>32</td> </tr> </tbody> </table> <br /> We now ask you several questions on these proposed projects.<br /> &nbsp;` ; // This is important, otherwise, the element you add will be at the back base_element.style.zIndex = 1; new_element.style.zIndex = 10; });
不过我发现,通过JS插入的文本和表格,在字体大小、整体格式上和Qualtrics默认的问题文本完全不一样。我特意在同一页面不加分页放了一段完全相同的文本做对比,效果如下:

有没有大佬知道怎么解决这个格式不一致的问题?
编辑补充:
我试过移除自己加的自定义CSS,但问题还是存在,效果见下图:

附上我之前在外观设置里使用的自定义CSS代码:
.Skin .QuestionBody { min-width: 1300px!important; } .Skin .QuestionText { min-width: 1300px!important; } .Skin .SkinInner { min-width: 1400px!important; } @media only screen and (max-width: 768px) { .Skin .QuestionBody { min-width: auto !important; } .Skin .QuestionText { min-width: auto !important; } .Skin .SkinInner { min-width: auto !important; } }
备注:内容来源于stack exchange,提问作者canIchangethis
相关产品推荐
相关产品推荐

