Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • in reply to: Add number label on Portfolio Grid. #907696

    Hello,

    Thanks to your response, I was able to generate the number dynamically by using .attr and use it as my CSS content value for the pseudo element.

    Here’s the JS/jQuery code I use:

    jQuery(document).ready(function($){
    	var num = 0;
    	$(.post-entry-521 .grid-sort-container .post-entry").each(function(){
    		num +=1;
    		$(this).attr('data-number',num);
    	});
    });

    And the CSS for the ::before

    .post-entry-521 .grid-sort-container .post-entry::before {
        content: attr(data-number);
    }

    Hope this help somebody in the future.

    • This reply was modified 6 years, 10 months ago by philscan.
Viewing 1 post (of 1 total)