klugjo / hexo-theme-magnetic

Adaptation of http://pixelhint.com/magnetic-free-html5-responsive-photography-website-template/ for hexo
187 stars 66 forks source link

Adjustable custom cover_detail height. #30

Open pegasusearl opened 2 years ago

pegasusearl commented 2 years ago

Hello, I am trying to make the post's cover_detail to have adjustable height.

I modify file /layout/_partial/article-full.ejs like this:

    <section class="top" style="background: url('<%- item.cover_detail || theme.default_cover_detail %>');
        <% if (item.cover_height) { %>
            height: item.cover_height
        <% } %>
          ;">
        <div class="wrapper content_header clearfix">
            <%- partial('article-full-nav', {item: item}) %>
            <h1 class="title"><%- item.title || theme.default_post_title || "Untitled" %></h1>
        </div>
    </section><!-- end top -->

however I don't really understand what I'm doing.

I wanna add cover_height property to my post. If the post has it, then it will modify cover_detail weight by adding height: item.cover_height

But I don't know why it does not work. Perhaps because it's inside quotation mark? I don't know what I can do to make it work. using height: 480px works but then I won't be able to adjust the height per post.

And I noticed the height value should be set to actual_height - 150px. I wonder where this number came from. So it should be height: item.cover_height - 150px but I also don't know if math equation worked there, or how to do it.

Sorry if it might be noob question. I hope I may get guidance.

Thank you for this amazing theme.

Edit: ehh looks like actual_height - 150px is wrong. Uhm, what are the formula? Where is 350px in main.css came from? And also, if it's possible to adjust weight automatically based on the image that would be even better.

klugjo commented 2 years ago

Hi sorry, it has been years since I have worked on this theme :D

Were you able to figure this out, your guess is as good as mine at this point.