4
I’m trying to hide the SCM Music Player and expand the main container to 100% (because the player reduced it a bit at the bottom) on my Tumblr blog but my code doesn’t work.
The Javascript code:
setTimeout(function () {
$(function(){
$('body').contents().find('iframe').contents().find('#contentW').css({top: 0px; bottom: 0px; right: 0px;});
$('body').contents().find('iframe').contents().find('#playerW').css({display: none;})
});
}, 5000);
The page structure already loaded (note that I omitted some unnecessary parts):
<html>
<head>
// algumas tags do Tumblr
</head>
<body>
<iframe> // Iframe desnecessário gerado pelo SCM
<html>
<head>
// algumas tags do SCM
</head>
<body>
<div id="contentW" style="top: 0px; bottom: 25px; right: 0px;">
// O CONTAINER PRINCIPAL DO BLOG ESTÁ AQUI
</div>
<div id="playerW" style="top: auto; bottom: 0px; height: 25px;">
// O PLAYER QUE EU QUERO OCULTAR
</div>
</body>
</html>
</iframe>
</body>
</html>
What’s wrong with it?
Try to do something direct:
$("playerW").css("display", "none!important");
. Two questions regarding your question: 1 - Why use Jquery? Does Tumblr not allow you to modify CSS directly? 2 - Why are you doing this inside asetTimeout
, some specific reason?– Renan Gomes
1-) Yes, but I’ve tried and it doesn’t work (maybe because it’s inside an iframe). 2-) In fact it is to wait for the site to fully load before executing the code (I know the correct is Document.ready, but I was just testing like this).
– José Neto
But I will test this code you passed...
– José Neto