Webpage Section Visible Only For Mobiles

This question already has an answer here:

  • What is the best way to detect a mobile device in jQuery? 49 answers

  • You could use a Responsive Design approach and achieve what you want with only css, using media queries:

    //THIS CSS CLASS IS APPLIED ALWAYS
    div.my-option {
        display: none;
    }
    
    //THIS MEDIA QUERY APPLIES ITS STYLES ONLY WHEN THE SCREEN WIDTH IS <= 767, SO IT'S A SMARTPHONE DISPLAY.
    //IT OVERRIDES THE ONE ABOVE
    @media only screen and ( max-width: 767px ) {
        div.my-option {
            display: inline;
        }
    }
    

    If you're interested in Responsive Design, two of the most extended options are Bootstrap and Zurb Foundation

    链接地址: http://www.djcxy.com/p/84068.html

    上一篇: YouTube API不适用于iPad / iPhone /非

    下一篇: 网页部分仅可见于手机