我在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>