Search code examples
jquerydrop-down-menutumblr

Is there a way to target specific tumblr posts with jquery?


What I am trying to achieve is an effect similar to this: [Davidslog.com] I like how when you hover over a post, a dropdown appears.

I've managed to do something similar using this code:

<script type="text/javascript">
   $(function() {
        $('.entry').hover(function() { 
            $('.notes').slideToggle(300); 
            });
    });
</script>

.Entry being the post container, and .notes being the notes div. This works, but not individually.

Hovering over an entry div drops down the notes pane for all entry divs, not just that particular one.

I tried giving the notes div the name of ".notes{PostID}" but jquery didn't seem to register that.

({PostID} being the unique id that tumblr assigns to every post.)

So basically I am stuck. All I want to do is have it so hovering over a post makes the notes div dropdown, but I can't seem to achieve that because the only unique post identifier doesn't work in jquery. Can anyone recommend a way to fix it, or even a better method?


Solution

  • try:

      $(function() {
            $('.entry').hover(function() { 
                $(this).find('.notes').slideToggle(300); 
                });
        });
    

    It should only target the hovered .entry children