JavaScript Optimize the loading of my Tumblr with JavaScript to customize styles

-- Hi !

Reader, if you are not comfortable with Tumblr, please tell me, I will give more details!

I had some issues on my tumblr page with the default theme 'Optica'. When I post an embed SoundCloud track, here is what I get on the page:

photo below

NOTE: I have tried to change the theme, and I discovered that for some of them, everything goes fine, but there are a few others with the same bug

So I've tried to fix that, and I've located the origin of the bug in the styles sheet main.css:

.video .video-wrapper {
background: #111;
position: relative;
padding-bottom: 56%;
height: 0;
}

The thing is, that to publish an embed code, you have to do it through the "Video post" tool on your tumblr dashboard, which then allows to style the embed code with the .video-wrapper

Of course, what I want to do here is reducing the bottom padding, but if I do it that way, it will affect all "Video posts". So I used the existing class .soundcloud_audio_player in the iframe to "mark" this type of Video posts to be able to change the styling only of these Video posts.

I have simplified it, and here is what it looks like at the end in browser:

<article class="audio not-page post-70801339374 " data-post-id="post_70801339374">
<div class="post-wrapper clearfix">
    <section class="post">
        <figure>
            <div class="video-wrapper">
                <iframe class="soundcloud_audio_player" />
            </div>
        </figure>
        <section class="attribution-tags clearfix">
            <ul>
                <li>
                    <a target='_blank' href="http://hymced.tumblr.com/tagged/SoundCloud" class="tag">SoundCloud</a>
                </li>
                <li>
                    <a target='_blank' href="http://hymced.tumblr.com/tagged/Blutch" class="tag">Blutch</a>
                </li>
            </ul>
        </section>
    </section>
    <section class="panel" />
</div>
<article>

And now, what I have put between tags in my Tumblr customized HTML:

<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("jquery", "1.3");
google.setOnLoadCallback(function() {
    jQuery(function($) {
        $("iframe.soundcloud_audio_player").parents('div.video-wrapper').css("padding-bottom", "17%");
    });
});
</script>

I used jQuery because I didn't know anything about JavaScript or jQuery before today, and I thought it what simpler! But maybe I'm wrong. Anyway, PROBLEM #1 FIXED!

NOW, PROBLEM #2

When the page is loading, the former styling (before than JS intervene) appears for 1 or 2 sec (with my bandwidth anyway!) and it's quite ugly:

photo below

I've looked a bit here http://www.memodev.com/wiki/Optimiser_un_site_Web and here https://developers.google.com/speed/docs/best-practices/rules_intro?hl=fr-FR

But I can't find how to improve the loading, and I hope some of you guys can :)

PageSpeed test below

Answer:1

I would like to dynamically remove or disable a <style> tag that looks like this <style type="text/css" id="cssx/portal/simple-sidebar.css" designtr="cssx/portal/simple-sidebar.css"> #...

I would like to dynamically remove or disable a <style> tag that looks like this <style type="text/css" id="cssx/portal/simple-sidebar.css" designtr="cssx/portal/simple-sidebar.css"> #...

  1. find style attribute using jquery
  2. jquery find style attribute
  3. jquery find style attribute value
  4. javascript find style attribute
  5. find element by style attribute jquery
  6. jquery find inline style attribute

I really need help. I am a newbie programmer and really not sure how can i do this in joomla. I need to create a pop up or iframe that pass variable from the parent page. Basically what is to happen ...

I really need help. I am a newbie programmer and really not sure how can i do this in joomla. I need to create a pop up or iframe that pass variable from the parent page. Basically what is to happen ...

  1. create popup iframe javascript
  2. create iframe popup
  3. how to create iframe popup window
  4. how to create iframe popup window in asp.net

I'm trying to create a client-side only application using Firebase as a database service and I'm experiencing some difficulties defining a security rules that will allow multiple 'admin' users access ...

I'm trying to create a client-side only application using Firebase as a database service and I'm experiencing some difficulties defining a security rules that will allow multiple 'admin' users access ...

While using Bootstrap 2.3, Bootbox and viewing the result in Google Chrome on Ubuntu you get a less than appealing border around the button because it is auto-focused. I havent found any api hooks to ...

While using Bootstrap 2.3, Bootbox and viewing the result in Google Chrome on Ubuntu you get a less than appealing border around the button because it is auto-focused. I havent found any api hooks to ...

  1. bootbox remove autofocus