Comments (22)
I'm having this same problem. I'm calling a function called sidrSetup() when the window is resized which checks to see if the window is less than 960px and then calls .sidr() on my menu link.
from sidr.
I will try to reproduce it and to solve it during this weekend.
from sidr.
Thanks - much appreciated.
Let us know if you crack it.
from sidr.
Still can't crack this the proper way, but I came up with a cheap dirty hack: it's a pretty obvious and inelegant solution but thought I'd post it.
- Set a variable (e.g. counterHack) to 0.
- In the on-complete function, which does activate first time even if the toogle itself doesn't, add a decision layer in that checks if the counterHack === 0, and if so adds one, and then runs the toogle function as you tried originally.
- The next time the on-complete function is run (which will actually be right after this, as the toogle function you activate from within the decision pathway will have this same on-complete call), the else side of the decision will be activated, so this is where you need to put any code you want to execute genuinely on a successful toogle event.
That seems over-explained - it's actually very simple and hopefully will help.
If anyone finds a better solution let me know though. Thanks.
from sidr.
Thanks a lot man -- I'll use this for now and post here if I come across a better solution.
from sidr.
@josholdham can you give a code example? Thanks
from sidr.
I got it! :D Simple, add
$sideMenu.hide(); //at line 195.
The problem is that the menu .is(':visible') at start and doesn't go trought the condition
if('open' === action || ('toogle' === action && !$menu.is(':visible'))) { ... } //at line 71
from sidr.
I tried adding $sideMenu.hide(); but still not working...
from sidr.
Check this file
http://www.soluvox.ca/wp-content/themes/soluvox/javascripts/jquery.sidr.min.js
It worked for me. Maybe it's the line 195 who aren't the exact line
from sidr.
I have the same problem, but when I use your file the menu works only one time.
from sidr.
Check this website http://soluvox.ca/ i uses it and it works well. Maybe it can help you!
from sidr.
I can not find the error. :(
My code for the menu: http://jsfiddle.net/Db6hs/
EDIT: I found it in the css file... display: none; :)
from sidr.
@artberri I am having the same issue with having to click/tap the menu button twice for the sidr menu to open. Is there a solution?
I have looked through all the forums and not one solution.
I tried adding the $sideMenu.hide(); as suggested by @DWboutin , but that seemed to work on a previous version when the code had some typos.
Great plugin :)
...but kinda desperate.
from sidr.
I posted a potential solution here: #133
It might work for you all?
HTH
-Aaron
from sidr.
I used this:
< style>
#mobile-header {
display: none;
}
@media only screen and (max-width: 767px){
#mobile-header {
display: block;
}
}
</ style>
< script>
$(function() {
$('#responsive-menu-button').sidr({
name: 'sidr-main',
source: '#navigation'
});
jQuery.sidr('close', 'sidr-main');
$(window).resize(function () {
jQuery.sidr('close', 'sidr-main');
});
});
</ script>
< div id="mobile-header">
< a id="responsive-menu-button" href="javascript:void(0)">Menu</ a>
</ div>
Solved the double click and does the menu disapeare when resizing.
No need to adjust the source js file.
Not tested on mobile devices yet...
from sidr.
The only solution that works for me is closing sidr after its initialization. So code looks like:
$(document).ready(function() {
$('#sidr-menu').sidr();
$.sidr('close', 'sidr');
});
Hope it will help someone
from sidr.
Script from @DWboutin worked. Thank you!
from sidr.
@MichelMathijssen this worked like a charm—thanks man
from sidr.
I had similar issue with sidr on my android device (on chrome mobile debugger obn desktop the bug didn't reproduced), when I click the link to open the sidr, it always redirected me back to homepage
I tried @DWboutin code, and that bug also disappered! thank you very much!
from sidr.
Well, when using @DWboutin version of code, it appears that the onOpen and onClose events are missing, how can the two be merged?
from sidr.
Just make sure whatever you named the sidebar to hide it with CSS:
// JS
$( '.mobile-toggle-button' ).sidr({
name: 'sidr-main',
source: '#navigation'
});
/*css*/
#sidr-main { display: none; }
from sidr.
@wpexplorer gave you the proper answer. You need to hide the sidebar on CSS.
from sidr.
Related Issues (20)
- sidr is removing one class and I need it so is there any solution so sidr doesn't remove it? or any other solution? HOT 3
- sidr option to resize container area instead of moving it
- When use plugin with jquery 3<= have problem with "bind" and "unbind",maybe replace it by "on'' and "off"? HOT 1
- In ios, why is the transition on the initialization time? HOT 1
- Update jsDelivr links
- Sidr is appending #sidr-0 in URL in first time and nothing happens HOT 1
- parent menu not clickable HOT 2
- Hide sidr when clicking / touching outside the sidr HOT 1
- Option to use original DOM elements instead of clones HOT 4
- Real example of Remotly Load content with jquery and Ajax HOT 1
- Can I use it in React?
- Menu not closing on body click HOT 1
- iphone safari white (background?)
- get rid of the "undefined" message
- jQuery 3.4.0 .data() bug
- How To Slide to Close the' Nav'
- Missing "main" entry point in package.json
- right to left
- dynamic width of sidr
- Save toggle state
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sidr.