Creating a sidebar in jQuery mobile

前端 未结 2 2075
春和景丽
春和景丽 2021-02-19 08:13

Normally, when you create a data-role=\"page\" element with jQuery mobile, it takes over the entire viewing area. For this reason, I don\'t understand how to create a sidebar. I

2条回答
  •  深忆病人
    2021-02-19 09:13

    You need to add this code to a javascript file:

    function setPositions(){
        var winwidth = $( window ).width()
    
        if( winwidth >= 750 ){
            $('.content-secondary').css({'float':'left','width':'35%'});
            $('.content-primary').css({'margin-left':'36%'});
        }
        else{
            $('.content-secondary').css({'float':'none','width':'100%'});
            $('.content-primary').css({'margin-left':'0px'});
        }
    }
    
    
    $(function(){
        setDefaultTransition();
        $( window ).bind( "throttledresize", setPositions );
    });
    

提交回复
热议问题