如何测试javascript的不同媒体查询
下面我已经写了如何测试javascript的不同媒体查询,javascript,css,Javascript,Css,下面我已经写了javascript,我想为每个不同大小的桌面设备在按钮上添加工具提示。有谁能告诉我如何在我的javascript中提到不同的媒体屏幕,以及如何在笔记本电脑中对style中包含的每个媒体屏幕进行测试 <style> .banner-text>div>.banner-link.link-highlight { display: none; } .booking-widget-home
javascript
,我想为每个不同大小的桌面设备在按钮上添加工具提示。有谁能告诉我如何在我的javascript
中提到不同的媒体屏幕,以及如何在笔记本电脑中对style
中包含的每个媒体屏幕进行测试
<style>
.banner-text>div>.banner-link.link-highlight
{
display: none;
}
.booking-widget-home
{
background-image: url('https://www.goxyz.in/content/dam/goxyz/6e-website/banner/target/05/Banner-Blue-checks.jpg') !important;
}
.banner-title
{
color: white;
}
.banner-description
{
color: white;
}
.offers-container.offers-up
{
cursor: pointer;
}
.banner-link.link-highlight
{
border-radius: 10px;
}
.ntooltip
{
position: absolute;
background: #92dff6;
color: #3e3158;
padding: 2px 0;
border-radius: 10px;
bottom: 42px;
left: 100px;
text-align: center;
font-size: 11px;
width: 130px;
box-shadow: 2px 5px 14px 0 rgba(0, 0, 0, .5);
}
.ntooltip:before
/* triangle decoration */
{
width: 0;
height: 0;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-bottom: 10px solid #92dff6;
content: '';
position: absolute;
left: 50%;
top: -10px;
margin-left: -10px;
}
</style>
<script>
(function()
{
'use strict';
var cnt = 6000;
function init()
{
if (typeof jQuery != "undefined")
{
// call to change content
content_change();
}
else
{
cnt = cnt - 500;
if (cnt > 500) setTimeout(init, 500);
}
}
// function to change your content
function content_change()
{
if (jQuery(".booking-widget-home").length > 0)
{
jQuery('.offers-container.offers-up > .offers-wrapper > div >h1 ').text('Kerala Alert!');
jQuery('.offers-container.offers-up > .offers-wrapper > div > p.banner-description ').html("Tooltip test is successfull</br><span><a href='https://www.goggle.com' target='_blank' class='banner-link link-highlight'>Add snacks</a></span>");
$('.banner-description > span').append('<div class="ntooltip">Click Here to Know More</div>');
}
else
{
cnt = cnt - 500;
if (cnt > 500) setTimeout(content_change, 500);
}
}
init();
})()
</script>
.banner text>div>.banner-link.link-highlight
{
显示:无;
}
.订房
{
背景图像:url('https://www.goxyz.in/content/dam/goxyz/6e-website/banner/target/05/Banner-Blue-checks.jpg")重要,;
}
.横幅标题
{
颜色:白色;
}
.横幅说明
{
颜色:白色;
}
.offers-container.offers-up
{
光标:指针;
}
.banner-link.link-highlight
{
边界半径:10px;
}
恩托尔提普先生
{
位置:绝对位置;
背景#92dff6;
颜色:#3e3158;
填充:2px0;
边界半径:10px;
底部:42px;
左:100px;
文本对齐:居中;
字体大小:11px;
宽度:130px;
盒影:2px 5px 14px 0 rgba(0,0,0,5);
}
恩托尔提普:以前
/*三角装饰*/
{
宽度:0;
身高:0;
左边框:8px实心透明;
右边框:8px实心透明;
边框底部:10px实心#92dff6;
内容:'';
位置:绝对位置;
左:50%;
顶部:-10px;
左边距:-10px;
}
(功能()
{
"严格使用",;
var-cnt=6000;
函数init()
{
if(jQuery的类型!=“未定义”)
{
//调用以更改内容
内容变化();
}
其他的
{
cnt=cnt-500;
如果(cnt>500)设置超时(init,500);
}
}
//函数更改您的内容
函数内容更改()
{
if(jQuery(“.booking widget home”).length>0)
{
jQuery('.offers-container.offers-up>.offers-wrapper>div>h1').text('Kerala Alert!');
jQuery('.offers-container.offers-up>.offers-wrapper>div>p.banner-description').html(“工具提示测试成功”;
$('.banner description>span').append('单击此处了解更多信息');
}
其他的
{
cnt=cnt-500;
如果(cnt>500)设置超时(内容更改,500);
}
}
init();
})()
要在桌面上进行测试,只需减小浏览器窗口的大小使用浏览器中的开发者工具(按F12键),您将通过移动仿真器看到移动选项Hi@Roy我可以检查各种移动设备。在这里,我想检查具有不同媒体屏幕的桌面设备。使用相同的工具。它检查所有屏幕的分辨率