Awesome q2a theme

History API + Magnific Popup?

0 like 0 dislike
34 views
Trying to connect the history api to magnific popup
found interesting content https://github.com/EugeneDae/Magnific-Popup-Histor...
but how can I use it if I have a popup called using onclick? and then the content is loaded via ajax , please help beginner

Javascript
Wo_OpenLightBox function(post_id) { $('#contnet').append(''); $.get(Wo_Ajax_Requests_File(), {f:'open_lightbox', post_id:post_id}, function(data) { if (data.status == 200) { var url = post_id; history.pushState(null, title, url); document.body.style.overflow = 'hidden'; $('.lightbox-container').html(data.html); } if (data.html.length == 0) { document.body.style.overflow = 'auto'; } }); }


AJAX
if ($f == 'open_lightbox') { $html = "; if (!empty($_GET['post_id'])) { $wo['story'] = Wo_PostData($_GET['post_id']); if (!empty($wo['story'])) { $html = Wo_LoadPage('lightbox/content'); } } $data = array( 'status' => 200, 'html' => $html ); header("Content-type: application/json"); echo json_encode($data); exit(); }
by | 34 views

1 Answer

0 like 0 dislike
history.js what if you can get the story through
if (localStorage.getItem('history') === null) { } else{ document.getElementById( 'result' ).innerHTML =localStorage.getItem('history'); };

and through, both
window.history
var i = 0;(function(history){ var pushState = history.pushState; history.pushState = function(state) { if (typeof history.onpushstate == "function") {history.onpushstate({state: state});} return pushState.apply(history, arguments); }})(window.history); window.onpopstate = history.onpushstate = function(e){ i++; test=JSON.stringify(e.state);
by

Related questions

0 like 0 dislike
1 answer
asked May 21, 2019 by cashloveyou
0 like 0 dislike
2 answers
asked Apr 11, 2019 by cashloveyou
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
110,608 questions
257,187 answers
0 comments
40,796 users