How to add section data-attribute with jQuery or else in Cornerstone?

Hi there!

i want to implement Midnight.js (http://aerolab.github.io/midnight.js/) to my child-theme.

functions.php looks like this:

//* Enqueue midnight.jquery.min.js
add_action( 'wp_enqueue_scripts', 'x_enqueue_midnight' );
function x_enqueue_midnight() {
	wp_enqueue_script( 'midnight.jquery.min.js', get_stylesheet_directory_uri() . '/js/midnight.jquery.min.js', array(), '', true );
}

 //* Add JavaScript before </body>
    function midnight_init() { ?>
    	<script>
    		// Start midnight
    		$(document).ready(function(){
        	// Change this to the correct selector for your nav.
        	$('nav.fixed').midnight();
      	});
    	</script>
    <?php }

Now i need to add data-attributes to my sections. How can i do this?

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.