Issue with Superfish Destroy function
I am trying to have the Superfish function destroy itself on screens less than 600px. I think I have the solution but it only works on Firefox, the other browsers I have tried it on (chrome, safari, and opera), the superfish does not get destroyed.
The site I am developing is currently on a local dev environment so I cannot link to the site but here is the code I am using. Also, it is built on Wordpress.
my superfish.min.js file is version 1.7.4 and my function is as follows
- /*
- * Custom Responsive Superfish settings
- */
-
- jQuery(document).ready(function($){
- var breakpoint = 600;
- var sf = $('ul.nav-menu');
-
- if($(document).width() >= breakpoint){
- sf.superfish({
- delay: 200,
- speed: 'fast'
- });
- }
-
- $(window).resize(function(){
- if($(document).width() >= breakpoint & !sf.hasClass('sf-js-enabled')){
- sf.superfish({
- delay: 200,
- speed: 'fast'
- });
- } else if($(document).width() < breakpoint) {
- sf.superfish('destroy');
- }
- });
- });
-
Any ideas on why its working in Firefox but not Chrome, Safari, or Opera?