auto scroll back
This commit is contained in:
@@ -87,13 +87,16 @@ function dropDownHide() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Close the dropdown menu if the user clicks outside of it
|
||||
window.onclick = function(event) {
|
||||
if (!event.target.matches('.dropbtn')) {
|
||||
dropDownHide();
|
||||
}
|
||||
}
|
||||
function get_cookie(name) {
|
||||
var nameEQ = name+"=";
|
||||
var ca = document.cookie.split(';');
|
||||
for(var i=0;i < ca.length;i++) {
|
||||
var c = ca[i];
|
||||
while (c.charAt(0)==' ') c = c.substring(1,c.length);
|
||||
if (c.indexOf(nameEQ) == 0) { return c.substring(nameEQ.length,c.length); }
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
function sortMarkdown(boughtOrder=false) {
|
||||
var divs = document.getElementsByClassName("entry");
|
||||
@@ -124,3 +127,19 @@ function orderStringSorter(a,b) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
function scrollBack() {
|
||||
var position=parseInt(get_cookie("position"));
|
||||
window.scrollTo(0,position);
|
||||
}
|
||||
|
||||
// Close the dropdown menu if the user clicks outside of it
|
||||
window.onclick = function(event) {
|
||||
if (!event.target.matches('.dropbtn')) {
|
||||
dropDownHide();
|
||||
}
|
||||
}
|
||||
document.onscroll = function(event) {
|
||||
document.cookie = "position=" + window.scrollY + "; path=" + window.location.pathname;
|
||||
}
|
||||
window.onload = scrollBack;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<input type=hidden name=shopid value="{{ shopid }}" >
|
||||
<div id="entry_loop">
|
||||
{% for entry in entries %}
|
||||
<div class=entry><input class="submit tickbox {{ entry.extra_class }}" type=submit name=item{{ entry.row }} value="{{ entry.icon }}" ><span class=md_entry>{{ entry.text|safe }}</span><br></div>
|
||||
<div class=entry><input class="submit tickbox {{ entry.extra_class }}" type=submit name=item{{ entry.row }} id=itemId{{ entry.row }} value="{{ entry.icon }}" ><span class=md_entry>{{ entry.text|safe }}</span><br></div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user