我想切换我的小部件,我有2个小部件1用于mobil,其他1用于桌面
这是我的js
<script src="https://apps.elfsight.com/p/platform.js" defer></script>
var width = screen.width;
$(document).ready(function() {
if (width < 600)
runMobile();
else
runDesktop();
});
var runMobile = function() {
$('mobile').show();
$('desktop').hide();
}
var runDesktop = function() {
$('desktop').show();
$('mobile').hide();
}
这是我的html
<div class="mobile" >
<div class="elfsight-app-06aeba27-ae5c-4c07-8050-1bc64351433a">
</div>
</div>
<div class="desktop">
<div class="elfsight-app-aa789e6f-6d76-4ffe-b234-984b2a8acd66">
</div>
</div>