mirror of
https://github.com/twisterarmy/twister-html.git
synced 2025-02-05 03:24:17 +00:00
fixed bug: back button shows up when navigated to first modal in history
This commit is contained in:
parent
40246e6e65
commit
69fdace49f
@ -397,20 +397,17 @@ function watchHashChange(e)
|
|||||||
{
|
{
|
||||||
|
|
||||||
if(e!=null){
|
if(e!=null){
|
||||||
|
|
||||||
var prevurlsplit = e.oldURL.split('#');
|
var prevurlsplit = e.oldURL.split('#');
|
||||||
var newurlsplit = e.newURL.split('#');
|
var prevhashstring=prevurlsplit[1];
|
||||||
var prevhashstring=prevurlsplit[1];
|
|
||||||
if(prevurlsplit[0]==newurlsplit[0] && prevhashstring!=undefined && prevhashstring.length>0 ){
|
var notFirstModalView=(prevhashstring!=undefined && prevhashstring.length>0 );
|
||||||
|
var notNavigatedBackToFirstModalView=(window.history.state==null || ( window.history.state!=null && window.history.state.showCloseButton!=false ) )
|
||||||
|
|
||||||
|
if(notFirstModalView && notNavigatedBackToFirstModalView ) ){
|
||||||
$('.modal-back').css('display','inline');
|
$('.modal-back').css('display','inline');
|
||||||
//$('.modal-back').on('click', function(e){
|
|
||||||
//e.stopPropagation();
|
|
||||||
//e.preventDefault();
|
|
||||||
//window.location.hash = '#' + prevhashstring;
|
|
||||||
|
|
||||||
//window.history.go(-1);
|
|
||||||
|
|
||||||
//});
|
|
||||||
} else {
|
} else {
|
||||||
|
window.history.pushState({showCloseButton:false},null,null);
|
||||||
$('.modal-back').css('display','none');
|
$('.modal-back').css('display','none');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user