forked from rDrama/rDrama
use history objection instead of location object to stop page from jumping unnecessarily
parent
bc8427d932
commit
0bcaef2e7f
|
@ -644,10 +644,11 @@ if (screen_width <= 768) {
|
||||||
|
|
||||||
if (object) {
|
if (object) {
|
||||||
object.addEventListener('shown.bs.modal', function (e) {
|
object.addEventListener('shown.bs.modal', function (e) {
|
||||||
|
const new_href = `${location.href.split('#')[0]}#m-${e.target.id}`
|
||||||
if (location.hash)
|
if (location.hash)
|
||||||
location.replace(`${location.href.split('#')[0]}#m-${e.target.id}`);
|
history.replaceState({}, '', new_href)
|
||||||
else
|
else
|
||||||
location.hash = `m-${e.target.id}`;
|
history.pushState({}, '', new_href)
|
||||||
});
|
});
|
||||||
|
|
||||||
object.addEventListener('hide.bs.modal', function (e) {
|
object.addEventListener('hide.bs.modal', function (e) {
|
||||||
|
|
Loading…
Reference in New Issue