I want to make a responsive banner, that changes depending of the resolution screen with php, js and html

I confess that I have a poor knowledge in php and js, but I’m trying to innovate and make a descent website. So I made 2 different slides, one for desktop and one for mobile, got a shortcode and i’m trying to put that in a html widget using a js screen width detection and mentioning it in the php code. Maybe its wrong in lots of levels but as I said I have no knowledge about that, so obviously didn’t work and the code just gave me a blank widget. What am I doing wrong?

    <script type="text/javascript"> $(document).ready(function () {   createCookie("width", $(window).width()); }); </script>  <?php if ($_COOKIE["height"] => 768px) {     echo do_shortcode('[URIS id=2822]'); }      else {         echo do_shortcode('[URIS id=2883]');     }  ?> 

The error message is:

768px) { echo do_shortcode('[URIS id=2822]'); } else { echo do_shortcode('[URIS id=2883]'); } ?> 
Add Comment
1 Answer(s)

My friend @ChristophKern helped me and I realize it was simpler than I though, I just used html and css instead js and php. The full code is:

<style> @media only screen and (min-width: 768px)  {   #slider-pro-3-2883     {     display: none;    } }  @media only screen and (max-width: 767px)  {   #slider-pro-3-2822     {     display: none !important;    } } </style>  [URIS id=2822] [URIS id=2883] 

Thank you Chris and Funk Forty Niner for the time spend to help me <3

Answered on July 16, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.