Skip to content

Commit

Permalink
Merge pull request ColorlibHQ#30 from christianesperar/master
Browse files Browse the repository at this point in the history
Fix menu not working on touch device, IE and NProgress error
  • Loading branch information
puikinsh committed Feb 26, 2016
2 parents a9ecf4e + 725fdf8 commit d7cabee
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 26 deletions.
3 changes: 0 additions & 3 deletions production/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@

<script src="js/jquery.min.js"></script>
<script src="js/nprogress.js"></script>
<script>
NProgress.start();
</script>

<!--[if lt IE 9]>
<script src="../assets/js/ie8-responsive-file-warning.js"></script>
Expand Down
57 changes: 34 additions & 23 deletions production/js/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,40 @@ $(function () {
$('#sidebar-menu li ul').slideUp();
$('#sidebar-menu li').removeClass('active');

$('#sidebar-menu li').click(function () {
if ($(this).is('.active')) {
$(this).removeClass('active');
$('ul', this).slideUp();
$(this).removeClass('nv');
$(this).addClass('vn');
$('#sidebar-menu li').on('click touchstart', function() {
var link = $('a', this).attr('href');

if(link) {
window.location.href = link;
} else {
$('#sidebar-menu li ul').slideUp();
$(this).removeClass('vn');
$(this).addClass('nv');
$('ul', this).slideDown();
$('#sidebar-menu li').removeClass('active');
$(this).addClass('active');
if ($(this).is('.active')) {
$(this).removeClass('active');
$('ul', this).slideUp();
} else {
$('#sidebar-menu li').removeClass('active');
$('#sidebar-menu li ul').slideUp();

$(this).addClass('active');
$('ul', this).slideDown();
}
}
});

$('#menu_toggle').click(function () {
if ($('body').hasClass('nav-md')) {
$('body').removeClass('nav-md');
$('body').addClass('nav-sm');
$('.left_col').removeClass('scroll-view');
$('.left_col').removeAttr('style');
$('body').removeClass('nav-md').addClass('nav-sm');
$('.left_col').removeClass('scroll-view').removeAttr('style');
$('.sidebar-footer').hide();

if ($('#sidebar-menu li').hasClass('active')) {
$('#sidebar-menu li.active').addClass('active-sm');
$('#sidebar-menu li.active').removeClass('active');
$('#sidebar-menu li.active').addClass('active-sm').removeClass('active');
}
} else {
$('body').removeClass('nav-sm');
$('body').addClass('nav-md');
$('body').removeClass('nav-sm').addClass('nav-md');
$('.sidebar-footer').show();

if ($('#sidebar-menu li').hasClass('active-sm')) {
$('#sidebar-menu li.active-sm').addClass('active');
$('#sidebar-menu li.active-sm').removeClass('active-sm');
$('#sidebar-menu li.active-sm').addClass('active').removeClass('active-sm');
}
}
});
Expand Down Expand Up @@ -312,6 +310,7 @@ $(function () {
});

/** ****** Accordion *********************** **/

/** ****** scrollview *********************** **/
$(document).ready(function () {

Expand All @@ -321,4 +320,16 @@ $(document).ready(function () {
});

});
/** ****** /scrollview *********************** **/
/** ****** /scrollview *********************** **/

/** ****** NProgress *********************** **/
if (typeof NProgress != 'undefined') {
$(document).ready(function () {
NProgress.start();
});

$(window).load(function () {
NProgress.done();
});
}
/** ****** NProgress *********************** **/

0 comments on commit d7cabee

Please sign in to comment.