Skip to content

Instantly share code, notes, and snippets.

@imuhammadshoaib
Created April 30, 2019 08:06
Show Gist options
  • Select an option

  • Save imuhammadshoaib/74584e808d900f888c36c823dba26338 to your computer and use it in GitHub Desktop.

Select an option

Save imuhammadshoaib/74584e808d900f888c36c823dba26338 to your computer and use it in GitHub Desktop.
DIVI nav js
<script>
window.onscroll = function() {scrollFunction()};
function scrollFunction() {
if (document.body.scrollTop > 200 || document.documentElement.scrollTop > 200) {
document.getElementById("navobar").style.top = "0";
document.getElementById("navobar").style.display = "block";
} else {
document.getElementById("navobar").style.top = "-500px";
}
}
</script>
<script type="text/javascript">
(function($) {
function setup_collapsible_submenus() {
var $menu = $('#mobile_menu'),
top_level_link = '#mobile_menu .menu-item-has-children > a';
$menu.find('a').each(function() {
$(this).off('click');
if ( $(this).is(top_level_link) ) {
if ($(this).parent().hasClass('always-visitable')) {
$('<a class="hover-link"></div>')
.attr('href', $(this).attr('href'))
.on('click', function(e){ e.stopPropagation(); })
.appendTo($(this));
}
$(this).attr('href', '#');
}
if ( ! $(this).siblings('.sub-menu').length ) {
$(this).on('click', function(event) {
$(this).parents('.mobile_nav').trigger('click');
});
} else {
$(this).on('click', function(event) {
event.preventDefault();
$(this).parent().toggleClass('visible');
});
}
});
}
$(window).load(function() {
setTimeout(function() {
setup_collapsible_submenus();
}, 700);
});
})(jQuery);
</script>
<script>
jQuery(function($){
$('.et_pb_accordion .et_pb_toggle_open').addClass('et_pb_toggle_close').removeClass('et_pb_toggle_open');
$('.et_pb_accordion .et_pb_toggle').click(function() {
$this = $(this);
setTimeout(function(){
$this.closest('.et_pb_accordion').removeClass('et_pb_accordion_toggling');
},700);
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment