I'm tryng to get my resize function to work in my jquery. What I'm trying to do is if my window size is bigger then 769 then it needs to display my hover menu else it shouldn't display it.
My $(window).load
works but not my $(window).resize
Here is my jquery
- function hover_menu(){
- $('ul.navbar-nav li').hover(
- function () {
- $(this).find('> ul').show();
- },
- function () {
- $(this).find('> ul').hide();
- }
- );
- }
- $(document).ready(function(){
- $(window).load(function(){
- var width = $(window).width();
- if(width > 769){
- hover_menu();
- }
- });
- $(window).resize(function(){
- var width = $(window).width();
- if(width > 769){
- hover_menu();
- }
- });
- });