Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

Creating a layer to remove sidepanel from mobiles. What am i doing wrong?

+2 votes
420 views
asked Mar 5, 2015 in Themes by gunrose

I am using the snow flat theme. I am testing in an Ipad.

class qa_html_theme_layer extends qa_html_theme_base {
    public function body()
    {
        if (qa_is_mobile_probably()) {
            if(isset($this->content['sidepanel'])){
                unset($this->content['sidepanel']);
            }
        }
        qa_html_theme_base::body();
    }
}

Q2A version: 1.7.0

2 Answers

+1 vote
answered Mar 5, 2015 by Kulani
edited Mar 5, 2015 by Kulani
This may not be exactly what you are looking for but I am using the new responsive SnowFlat theme which auto hides the side panel with a button to tongle it open/close on mobile devices.

See http://www.satechhelp.co.za/ (visit it using your mobile)
commented Mar 5, 2015 by Kulani
:( I here you - can only hope that somebody will soon come with a winning scheme for your issue. Justin.soni who has already replied ,for one, may just be able to come through for you!
commented Mar 5, 2015 by gunrose
Thank u, again!
0 votes
answered Mar 5, 2015 by jatin.soni

You do not need to unset anything here. Just override the sidepanel method into your theme or plugin file. See in the SnowFlat or FlatBox. I have used mobile detection to switch the sidepanel.

Something like below code

public function sidepanel()
{
    
    if ( ! qa_is_mobile_probably() ) {
        qa_html_theme_base::sidepanel();
    }

}
commented Mar 5, 2015 by gunrose
Thank you again! Also for the theme that you have been providing to us!
commented Mar 5, 2015 by gunrose
Is there a version (1.5?) of Snow Flat of the Candy theme that works in the stable version of 1.7 q2a?  I tried this one https://github.com/q2a/question2answer, but it didnt work!
...