Close sidebar after a pjax event occurs and we're in mobile view
This commit is contained in:
parent
7c855e2c94
commit
4de691f66a
|
@ -40,17 +40,15 @@ $( document ).ready(function() {
|
|||
$('.form-line').removeClass("focused");
|
||||
});
|
||||
|
||||
// leftsidebar
|
||||
|
||||
|
||||
/*
|
||||
* When a sidebar item is clicked in mobile - let's make sure we push the sidebar back in
|
||||
*/
|
||||
|
||||
$(document).on('click','a',function(){
|
||||
console.log("click");
|
||||
// $(this) = your current element that clicked.
|
||||
// additional code
|
||||
$(document).on('on_pjax_complete',function(){
|
||||
if($('.ls-closed').length > 0){
|
||||
$('body').removeClass('overlay-open');
|
||||
$('.overlay').css("display", "none");
|
||||
}
|
||||
});
|
||||
|
||||
function modal (title, content, buttons) {
|
||||
|
|
|
@ -73,7 +73,7 @@ function do_pjax_request(request_url){
|
|||
/* Destroy some dynamically spawned assets */
|
||||
|
||||
$('#body-content').css("opacity", ".1");
|
||||
|
||||
|
||||
if(pjax_cache[request_url] && ignore_cache != 1){
|
||||
if (typeof e !== 'undefined') {
|
||||
e.preventDefault();
|
||||
|
@ -93,6 +93,8 @@ function do_pjax_request(request_url){
|
|||
|
||||
$(scroll_target).animate({scrollTop: 0}, 100);
|
||||
|
||||
$( document ).trigger( "on_pjax_complete");
|
||||
|
||||
last_navigated_url = request_url;
|
||||
|
||||
if(pjax_debug){ pjax_console('loaded cached ' + request_url); }
|
||||
|
@ -116,6 +118,9 @@ function do_pjax_request(request_url){
|
|||
$('#body-content').css("opacity", "1");
|
||||
$('#body-content').html(e_res);
|
||||
|
||||
$( document ).trigger( "on_pjax_complete");
|
||||
|
||||
|
||||
/* Cache the result */
|
||||
pjax_cache[request_url] = e_res;
|
||||
|
||||
|
|
Loading…
Reference in New Issue