• Hi, I would like to add some fancy CSS to my review blog. When a user hovers over the first image of the review it shows up the score. I’ve managed to get this working with some help in Fiddle:
    https://jsfiddle.net/1wusom4m/3/

    But when I copy paste the relevant css and HTML the hover effect doesn’t work. It’s unclear why this is the case

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • You have some Javascript/JQuery problems in this page.
    I believe this overlay problem is related to these scripts issues.

    To see how to detect these errors, please refer to this Codex article:

    https://codex.wordpress.org/Using_Your_Browser_to_Diagnose_JavaScript_Errors

    Thread Starter Nostra

    (@nostra)

    Wow, just tried that and was surprised by the amount of errors in the debug mode. I’ve looked in Safari and see the following ones:
    [Error] Failed to load resource: the server responded with a status of 404 (Not Found) (ml-parallax.css, line 0)

    [Error] SyntaxError: Unexpected token ‘;’
    (anonymous function) (three-billboards-outside-ebbing-missouri-2017-recensie:550)

    [Error] ReferenceError: Can’t find variable: paginateVal
    (anonymous function) (cgview.js:28)
    i (jquery.js:2:27455)
    fireWith (jquery.js:2:28215)
    ready (jquery.js:2:30018)
    K (jquery.js:2:30374)

    [Error] WebSocket connection to ‘wss://public-api.wordpress.com/pinghub/wpcom/me/newest-note-data’ failed: Unexpected response code: 403

    Which one might be causing the issue and how would I approach solving it?

    For the way I see this overlay effect, it has nothing to do with scripts itself, but the scripts may be those responsible for compromising the css loading, this is just a guess.

    One question, how are you applying this style sheet?

    Are you using a specific plugin for this or are you using the standard theme customization in the dashboard to apply the css?

    Thread Starter Nostra

    (@nostra)

    No, I’m not using a plugin for this. I’ve adjusted the css in the editor (style.css)

    You’ll find it amazing, but comparing both versions (the actual site version and the JSFiddle one) I noticed only 1 difference when it comes to the div where you’re putting the image, which is a <br /> tag.

    I copied your code and removed this tag and the overlay effect came back to normal, it will be only a question of correctly positioning it.

    So instead of :

    <div class="profile-image10">
      <a href="#"><img src="http://www.defilmkijker.com/wp-content/uploads/2018/01/Recensie-Three-Billboards-Outside-Ebbing-Missouri.jpg" class="alignnone size-full wp-image-19857 round" /></a><br />
      <span class="overlay"></span>
    </div>

    use

    <div class="profile-image10">
      <a href="#"><img src="http://www.defilmkijker.com/wp-content/uploads/2018/01/Recensie-Three-Billboards-Outside-Ebbing-Missouri.jpg" class="alignnone size-full wp-image-19857 round" /></a>
      <span class="overlay"></span>
    </div>

    and then tell me the result.

    Thread Starter Nostra

    (@nostra)

    Great find! When I’m in the editor I don’t see a <br /> tag, but you are right that it does show up in the page source. Maybe it is added by entry-content class?

    When I look at the single post php it only has this:

    <div class="entry-content">
    						<?php
    							the_content();
    							wp_link_pages( array(
    								'before' => '<div class="page-links">' . __( 'Pages:', 'untitled' ),
    								'after'  => '</div>',
    							) );
    						?>
    					</div><!-- .entry-content -->

    Looking at the content.php (which I’ve edited to show a dutch text instead of Read more) it has this:

    		<div class="entry-content">
    			<?php the_content( __( 'Lees verder <span class="meta-nav">&rarr;</span>', 'untitled') ); ?>
    			<?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'untitled' ), 'after' => '</div>' ) ); ?>
    		</div><!-- .entry-content -->
    • This reply was modified 6 years, 3 months ago by Nostra.
    • This reply was modified 6 years, 3 months ago by Nostra.
    Thread Starter Nostra

    (@nostra)

    Managed to find the cause of it:
    https://codex.wordpress.org/Function_Reference/wpautop

    By disabling that it now works!

    Thread Starter Nostra

    (@nostra)

    Just a small update, reading the WordPress documentation I read that the br is automatically added when adding an enter. So I simply made the code for the image one long line, which also fixed the issue.

    Thing I’ll have to look into now is to see how I’m going to use this on a mobile device as there is no hover, but I do want to give the reader an option to see the score I’ve given before opening the whole review.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘CSS Image overlay on hover with fade in’ is closed to new replies.