#jquery

LIVE

A few days ago i was trying to find a tumblr theme with a compact main page. I searched around one hundrend themes but i wasn’t able to find what i was looking for so i decided to create my own.

Here we are … Theme is still in alpha version and has some bugs i am trying to fix. I install it though  because i wanted to test it with some real posts.

There are also some things i want to add as well but thirst i have to fix the bugs. Here is the complete “to do” list:

  • Widget sticky posts
  • Widget also like posts
  • Slideshow on main page as first post
  • Fix the bug with the border around flash videos on main page
  • Move CSS to seperate file
  • Move Javascript to seperate file
  • Rewrite Javascript to a more compact way
  • Get rid of clear divs and put clearafter in their place
  • Get rid of all pictures from Technologic theme and make my own
  • Find better theme colors
  • Rewrite html get rid of useless divs
  • Drop the code bellow 64kb
  • Find a name for the theme

One of the biggest problems in tumblr blogs is that photo or video posts can’t have a title. Let’s see how we can solve this problem with JQuery.

First of all we need to import JQuery to our of theme if it doesn’t have it already. This can be done easily. GooglehostsJQuery for us. So the only thing we need to do is to tell our theme where to find it. We do this by adding the following code:

After that we need to search our theme to find the class in which the posts are holded. Every theme has a structure like this:

<div id=“content”> 
  <div class=“contentpost”>
    <div class=“video”>
    </div>
  </div>
  <div class=“contentpost”>
    <div class=“photo”>
    </div>
  </div>
</div>

The class contentpost is what we need. We now go and add this html code in our theme.

    {block:IndexPage}<h2 class=“multititle”><a href=“{Permalink}”></a></h2>{/block:IndexPage}
    {block:PermalinkPage}<h1 class=“multititle”></h1>{/block:PermalinkPage}    

If we don’t want the titles to be clickable we skip the <a href=“{Permalink}”></a> part. Now we add the JQuery code:

        <script type=“text/javascript”>
$(’.contentpost’).each(function(index) {
$(’.multititle a’, this).append( $(’.copy p:first-child’, this) );
$(’.multititle a’).find(‘p’).contents().unwrap();
});
</script>
<script type=“text/javascript”>
$(’.contentpost’).each(function(index) {
$(’.multititle’, this).append( $(’.copy p:first-child’, this) );
$(’.multititle’).find('p’).contents().unwrap();
});
</script>

You know need a final step. To add custom CSS in your theme and make class multititle look like the title of a text post. I can’t help with that without knowing your theme. 

Notes:

  • You can do it with much less JQuery code. This one is easier to understand though that’s why i used it.
  • If you don’t want clickable links you can skip the first script (The one with multititle a).
  • Multititle is just a class name i gave for the titles of posts and videos. You can give that class whatever name you want.
  • This is NOT a SEO guide. We just fix the appearance of our theme. If you care about SEO use text posts and embed photos  there.
  • You can see this guide like on http://killmytime.tumblr.com .
  • It will be better if you bold the first paragraph of your post and add append( $(’.copy p:first-child strong’, this) ); We do this to target only the specific first-child. If you check the effector theme for example it was another div inside .post-panel for the source:. This  is also a first-child. So if your title is:“Apple maps are bad” the result will be “Apple maps are badsource:blabla”.Again it depends on your structure of your theme. Just send me a message and i can help you.
  • You can do the same things with pure CSS. .p:first-child strong and style it. There are 2 problems with this approach. 1) The styling is easy. The positioning is HARD and different in each theme so i can’t write a guide about that. You need to use some absolute positioning. You can find out more here. 2) You can’t change the title to h2 or h1. It will still be a paragraph. I don’t know if google crawls it as h2 or h1. I think google still sees it as a paragraph. If someone knows for sure send me a message. 

Usefull links:

life-by-the-second:

Hello [coders, programmers, developers, software engineers]

I’m currently knee deep into a front-end coding bootcamp at the Georgia institute of Technology. My goal is to find a job as a front end developer when I get out, or another role writing code.


I’ve been writing code as a hobby for the past 15+ years - Mostly web development and python. This course provides lessons, practice, and projects for most of the front-end and some of the backend languages, libraries, frameworks, etc. that I need to get a job in the industry(Including projects to display in my portfolio.)


The reason I told you all of this is that I’m looking for someone to look at my code and projects to review and critique them.


If you wouldn’t mind helping me out with this, reply here, message me, or you can join my slack channel: Code Review

life-by-the-second:

Hello [coders, programmers, developers, software engineers]

I’m currently knee deep into a front-end coding bootcamp at the Georgia institute of Technology. My goal is to find a job as a front end developer when I get out, or another role writing code.


I’ve been writing code as a hobby for the past 15+ years - Mostly web development and python. This course provides lessons, practice, and projects for most of the front-end and some of the backend languages, libraries, frameworks, etc. that I need to get a job in the industry(Including projects to display in my portfolio.)


The reason I told you all of this is that I’m looking for someone to look at my code and projects to review and critique them.


If you wouldn’t mind helping me out with this, reply here, message me, or you can join my slack channel: Code Review

life-by-the-second:

Hello [coders, programmers, developers, software engineers]

I’m currently knee deep into a front-end coding bootcamp at the Georgia institute of Technology. My goal is to find a job as a front end developer when I get out, or another role writing code.


I’ve been writing code as a hobby for the past 15+ years - Mostly web development and python. This course provides lessons, practice, and projects for most of the front-end and some of the backend languages, libraries, frameworks, etc. that I need to get a job in the industry(Including projects to display in my portfolio.)


The reason I told you all of this is that I’m looking for someone to look at my code and projects to review and critique them.


If you wouldn’t mind helping me out with this, reply here, message me, or you can join my slack channel: Code Review

life-by-the-second:

Hello [coders, programmers, developers, software engineers]

I’m currently knee deep into a front-end coding bootcamp at the Georgia institute of Technology. My goal is to find a job as a front end developer when I get out, or another role writing code.


I’ve been writing code as a hobby for the past 15+ years - Mostly web development and python. This course provides lessons, practice, and projects for most of the front-end and some of the backend languages, libraries, frameworks, etc. that I need to get a job in the industry(Including projects to display in my portfolio.)


The reason I told you all of this is that I’m looking for someone to look at my code and projects to review and critique them.


If you wouldn’t mind helping me out with this, reply here, message me, or you can join my slack channel: Code Review

life-by-the-second:

Hello [coders, programmers, developers, software engineers]

I’m currently knee deep into a front-end coding bootcamp at the Georgia institute of Technology. My goal is to find a job as a front end developer when I get out, or another role writing code.


I’ve been writing code as a hobby for the past 15+ years - Mostly web development and python. This course provides lessons, practice, and projects for most of the front-end and some of the backend languages, libraries, frameworks, etc. that I need to get a job in the industry(Including projects to display in my portfolio.)


The reason I told you all of this is that I’m looking for someone to look at my code and projects to review and critique them.


If you wouldn’t mind helping me out with this, reply here, message me, or you can join my slack channel: Code Review

Hello [coders, programmers, developers, software engineers]

I’m currently knee deep into a front-end coding bootcamp at the Georgia institute of Technology. My goal is to find a job as a front end developer when I get out, or another role writing code.


I’ve been writing code as a hobby for the past 15+ years - Mostly web development and python. This course provides lessons, practice, and projects for most of the front-end and some of the backend languages, libraries, frameworks, etc. that I need to get a job in the industry(Including projects to display in my portfolio.)


The reason I told you all of this is that I’m looking for someone to look at my code and projects to review and critique them.


If you wouldn’t mind helping me out with this, reply here, message me, or you can join my slack channel: Code Review

Day 4: Today I played around with the Bootstrap documentation. It’s very easy to explore its many features. Then, I wanted to work on playing CSS animations on scroll. I was able to create a codepen using popular music meme titles.

Link to code: www.codepen.io

#100daysofcode    #womenwhocode    #codepen    #coding    #jquery    #bootstrap    #cssanimation    #javascript    #webdev    #web developer    #web development    #song meme    #frontend    

Day 3: I practiced using jQuery and animations together to create a party turtle. I also learned more about minified files and how they help reduce loading time of websites. You can minify CSS and JavaScript easily with Minify: https://www.minifier.org/.

Link to party turtle: https://codepen.io/

#100daysofcode    #coding    #womenwhocode    #jquery    #javascript    #cssanimation    #turtle    #partytime    #web development    #webdev    
loading