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]'); } ?>
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.