Skip to content

Instantly share code, notes, and snippets.

@anastransvelo
Forked from akther80/functions.php
Last active June 14, 2019 06:06
Show Gist options
  • Save anastransvelo/bf5e465b577dab910c19c2780cef28d0 to your computer and use it in GitHub Desktop.
Save anastransvelo/bf5e465b577dab910c19c2780cef28d0 to your computer and use it in GitHub Desktop.
Techmarket - Clickable Primary navigation parent menu
add_action( 'wp_enqueue_scripts', 'tm_child_enqueue_custom_js', 30 );
function tm_child_enqueue_custom_js() {
ob_start(); ?>
jQuery(document).ready(function($){
if (jQuery(window).width() >= 1025){
$(".primary-navigation .dropdown-toggle").click(function () {
var addressValue = $(this).attr("href");
location.href=addressValue;
console.log(addressValue );
});
}
});
<?php
$inline_js = ob_get_clean();
wp_add_inline_script( 'techmarket-scripts', $inline_js );
}
.primary-navigation .menu-item-has-children:hover:after {
position: absolute;
display: block;
content: ' ';
width: 100%;
height: 50px;
}
.primary-navigation .dropdown-menu {
display: none;
top: 50%;
margin-top: 30px;
}
.primary-navigation .menu-item-has-children:hover > .dropdown-menu {
display: block;
}
.primary-navigation .nav .menu-item-has-children>.dropdown-menu {
top: 20px;
}
.primary-navigation .nav .menu-item-has-children .menu-item-has-children .dropdown-menu {
left: 100%;
top: 0;
margin-top: 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment