简体   繁体   English

如何按下页面顶部的返回按钮

[英]How to push back button on top of the page

I am using a survey tool called Qualtrics and I was wondering if we can push the back button on the top left instead of bottom left, while the next button remains at the bottom我正在使用一个名为 Qualtrics 的调查工具,我想知道我们是否可以按下左上角而不是左下角的后退按钮,而下一个按钮仍保留在底部

I found a code that clones the buttons.我找到了一个克隆按钮的代码。 But I would only like to push the actual back button on top using JS但我只想使用 JS 将实际的后退按钮推到顶部

<script type="text/javascript">
Qualtrics.SurveyEngine.addOnReady(function() { jQuery('#HeaderContainer').after(jQuery('#Buttons').clone(1)); $('Header').insert($('Buttons')); });
</script>

Some help would be highly appreciated.一些帮助将不胜感激。

You can use the jQuery prepend() method:您可以使用 jQuery prepend()方法:

The jQuery prepend() method inserts content AT THE BEGINNING of the selected HTML elements. jQuery prepend()方法在所选 HTML 元素的开头插入内容。

// otherElement will be added as the first child to someElement
$('someElement').prepend(otherElement);  

Move the back button to just after the header:将后退按钮移到 header 之后:

<script type="text/javascript">
Qualtrics.SurveyEngine.addOnReady(function() { 
  jQuery('#HeaderContainer').after(jQuery('#PreviousButton'));
});
</script>

However, by moving it outside the buttons div (#Buttons), you may lose css styling.但是,通过将其移到按钮 div (#Buttons) 之外,您可能会丢失 css 样式。 Therefore, you may need to add some css to style the back button to match the next button.因此,您可能需要添加一些 css 来设置后退按钮的样式以匹配下一个按钮。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM