js-code-to-svg-flowchart
js-code-to-svg-flowchart copied to clipboard
Nested if-statement problem
Hi, nice catch! Can you pleae provide which caused that? So it will be able to debug it through.
Provide code :)
Hello bodgan .
The code is:
if ( $(document).width() >= 992) {
type = 'desktop';
}
else if ( $(document).width() >= 768) {
type = 'tablet';
}
else {
type = 'mobile';
}
Furthermore, I noticed that there are green boxes with "$(document)" as content.
@RiccardoGrigoletto , thanks, I'll have a look. But looks like it's an issue with $(document).width()
so actually methodCall().anotherMethodCall() structure fails, if you write your code in a way as below, it works fine

Actually, caching jQuery object to variable instead of creating it each time is better way of doing this 🙂
Here we are 👍 thank you :)