It should be helpfull to hide sidebar on slide left on mobile devices, could you make it possible ?
I've tryed by myself, but including jquery-mobile.js has wrong side effects with navigation...
thanks
Simone
swipe left on sidemenu
Forum rules
Please note that response time for technical support is within 3-5 business days.
Please note that response time for technical support is within 3-5 business days.
-
- Posts: 5281
- Joined: 29 Jun 2013, 12:38
I think you can use jquery Touch Swipe API; http://labs.rampinteractive.co.uk/touchSwipe/docs/
Exp;
After you add touch swipe plugin into your project, please try the following codes in layout.js;
Exp;
After you add touch swipe plugin into your project, please try the following codes in layout.js;
Code: Select all
...
bindEvents: function() {
var $this = this;
$(document.body).swipe({
swipeLeft: function() {
$this.menuButton.removeClass('active');
$this.wrapper.removeClass('sidebar-active-m');
$this.topbarIcons.removeClass('topbar-icons-visible');
},
swipeRight: function() {
$this.menuButton.addClass('active');
$this.wrapper.removeClass('sidebar-inactive-l').addClass('sidebar-active-m');
$this.topbarIcons.removeClass('topbar-icons-visible');
}
});
....
},
...
Github Profile: https://github.com/mertsincan
Thank you for your precious suggestion.
Your code seemed not to work properly, so i ended up writing this code:
What do you think, is it a good solution ? Is it possible to leave layout.js clean and put this code elsewhere ?
thanks
Simone
Your code seemed not to work properly, so i ended up writing this code:
Code: Select all
...
$(this.sidebar).swipe({
swipeLeft: function (event, direction, distance, duration, fingerCount) {
$this.menuButton.click();
}
});
...
thanks
Simone
Primefaces 12.0.2, Wildfly 24.0.1, JDK 11
-
- Posts: 5281
- Joined: 29 Jun 2013, 12:38
Thanks for the fix! I worked to close/open menu using swipeLeft/swipeRight on document.body. I think you only want to close menu.
//mycustomswipe.js
- Yes. You can add this fix into new JS file. Exp;Is it possible to leave layout.js clean and put this code elsewhere ?
//mycustomswipe.js
Code: Select all
// Please add swipe.js codes
$( document ).ready(function() {
var sidebar = $(document.body).children('.wrapper').children('.sidebar'),
menuButton = $('#omega-menu-button');
sidebar.swipe({
swipeLeft: function (event, direction, distance, duration, fingerCount) {
menuButton.click();
}
});
});
Github Profile: https://github.com/mertsincan
-
- Posts: 5281
- Joined: 29 Jun 2013, 12:38
You're welcome! Thanks for the update!
Github Profile: https://github.com/mertsincan
-
- Posts: 5281
- Joined: 29 Jun 2013, 12:38
Thanks for your suggestion! I'll add swipe feature into next release.
I think to add your code into next realase
I think to add your code into next realase
Code: Select all
$(this.sidebar).swipe({
swipeLeft: function (event, direction, distance, duration, fingerCount) {
$this.menuButton.click();
}
});
Github Profile: https://github.com/mertsincan
-
- Posts: 5281
- Joined: 29 Jun 2013, 12:38
- Rica ederimteşekkürler
Github Profile: https://github.com/mertsincan
-
- Information
-
Who is online
Users browsing this forum: No registered users and 3 guests