我想制作一个响应式横幅,它根据 php、js 和 html 的分辨率屏幕而变化
I want to make a responsive banner, that changes depending of the resolution screen with php, js and html
我承认我对php和js的了解很差,但我正在努力创新,做一个血统的网站。
所以我制作了 2 张不同的幻灯片,一张用于桌面,一张用于移动设备,得到了一个短代码,我试图使用 js 屏幕宽度检测将它放在 html 小部件中,并在 php 中提及它代码。也许它在很多层面上都是错误的,但正如我所说,我对此一无所知,所以显然没有用,代码只给了我一个空白的小部件。我做错了什么?
<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]');
}
?>
错误信息是:
768px) { echo do_shortcode('[URIS id=2822]'); } else { echo do_shortcode('[URIS id=2883]'); } ?>
我的朋友@ChristophKern 帮助了我,我意识到它比我更简单,我只是使用 html 和 css 而不是 js 和 php。完整代码为:
<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]
谢谢 Chris 和 Funk Forty Niner 花时间帮助我 <3
我承认我对php和js的了解很差,但我正在努力创新,做一个血统的网站。 所以我制作了 2 张不同的幻灯片,一张用于桌面,一张用于移动设备,得到了一个短代码,我试图使用 js 屏幕宽度检测将它放在 html 小部件中,并在 php 中提及它代码。也许它在很多层面上都是错误的,但正如我所说,我对此一无所知,所以显然没有用,代码只给了我一个空白的小部件。我做错了什么?
<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]');
}
?>
错误信息是:
768px) { echo do_shortcode('[URIS id=2822]'); } else { echo do_shortcode('[URIS id=2883]'); } ?>
我的朋友@ChristophKern 帮助了我,我意识到它比我更简单,我只是使用 html 和 css 而不是 js 和 php。完整代码为:
<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]
谢谢 Chris 和 Funk Forty Niner 花时间帮助我 <3