In my recently launched site I turned off rebuilding of the theme cache with each page
load as recommended. Now after some period of time the cache seems to become
corrupted, and the Superfish menus are all displayed cascading down the screen.
Within Safari's debugger I get:
TypeError: 'undefined' is not a function (evaluating 'jQuery('#superfish-1').supersubs({minWidth: 12, maxWidth: 27, extraWidth: 1})')
pointing to this code on the page:
<!--//--><![CDATA[//><!--
jQuery(function(){
jQuery('#superfish-1').supersubs({minWidth: 12, maxWidth: 27, extraWidth: 1}).superfish({
animation: {opacity:'show'},
speed: 'fast',
autoArrows: false,
dropShadows: true});
});
//--><!]]>
If I clear the cache everything returns to normal, and looks/works fine, for some period of hours, and
then it breaks again.
Drupal version is 7.12.
Not sure if this is a Superfish issue, Drupal core issue with caching, etc. Any suggestions (including
a better place to post this, if appropriate) would be appreciated.
Thanks!
Comments
Comment #1
mehrpadin commentedHey Andy,
Try the v1.9-beta4 please.
Comment #2
abrewster commentedUpgraded to the latest beta. Had a little trouble, the previous version didn't seem to fully uninstall
cleanly, at least not automatically. I'll keep an eye on it and post back.
Thanks!
Comment #3
abrewster commentedStill the same problem. It will work fine for some period, usually at least an
hour, sometimes maybe 10-12 hours, then fail again.
I'm thinking maybe this isn't a Superfish issue, but rather some interaction
between Superfish and a (corrupted?) theme cache. I never saw the issue
until I stopped rebuilding the them registry on every page load.
The theme caching is (I believe) the only caching going on so far. All the
other check boxes ("cache pages for anonymous users", "cache blocks",
"aggregate and compress CSS files", and "aggregate JavaScript files" are all
unchecked.
Any suggestions for what to try next?
Thanks!
Comment #4
abrewster commentedAny other thoughts or suggestions?
Comment #5
mehrpadin commentedEmail me the URL please.
Comment #6
czaku commentedHave the same problem for a long time, superfish is the module that has 4 blocks on my page (3 of them inside tabs in QuickTabs module, but it doesn't change anything as I did some testing), when they are not cached the page performance is very low...
So basically I hardcoded CSS files to the theme and just gave each superfish menu proper ul class so I could get around the CSS caching issue, but still .js files are not working when the superfish blocks are being cached, so my menus have no delay, no arrows etc..
you can check it here http://new.quantum.com.pl/en/about-us - you have the main top menu in superfish, and then on the left you have quicktabs (categories/manufacturers/applications) and the menus there are superfish as well.
Comment #7
dgtlmoon commentedI can confirm the same problem
Also getting this warning in my watchdog
a:6:{s:5:"%type";s:7:"Warning";s:8:"!message";s:182:"file_get_contents(/sites/all/libraries/superfish/superfish.js) [function.file-get-contents]: failed to open stream: No such file or directory";s:9:"%function";s:23:"drupal_build_js_cache()";s:5:"%file";s:72:"docroot/includes/common.inc";s:5:"%line";i:4817;s:14:"severity_level";i:4;}
Comment #8
dgtlmoon commentedIn my instance, it was caused by a dodgey drupal_add_js line that was handing
never hand full paths to drupal_add_js() :)
Comment #9
dgtlmoon commentedcheck your watchdog for warnings, that will rule out drupal_add_js failling
when it does fail, let us know if you see the superfish in the aggregated JS by grepping it
Comment #10
czaku commentedI don't have any warnings, what is more in Chrome Dev Tools I see all superfish.js files as loaded (http://new.quantum.com.pl/) but still you can see the main menu (navy one with yellow hover) in superfish doesn't load superfish.js file (no delay, cannot size subs in settings...)... There is even no default 600ms working, why is that? :(
Comment #11
dgtlmoon commentedis there another javascript error occuring?
Comment #12
dgtlmoon commentedthe menu there works for me in chrome
Comment #13
czaku commentedNo, but know I found that entry similar to yours, but its just one warning, not showing again after clearing cache, after I cc one page load is perfect, all js working, then next (cached ones) break... and there is no warning now at all..
Comment #14
czaku commentedYes, menu works, but I cannot set delay options, there are no arrow for submenus loaded etc... I cannot set supersubs size,
When i switch off cache on superfish menu block it all works without any changes, 600ms delay, supersubs bigger size etc
Comment #15
czaku commentedThis is my init where .js are loaded, maybe it's because of Libraries module? Any tips what should I change I dont see base_path() anywhere like you wrote in #8
I see all the superfish.js and other files loaded in Chrome Inspector, they are just not "being used"... Don't know what is going on...
Comment #16
dgtlmoon commentedunsure, but i've never seen someone use variable_get like that!
Comment #17
czaku commentedit's the genuine superfish module superfish.module file, I didn't change anything...
Comment #18
czaku commentedI noticed that when superfish block is cached there are 3 classes missing from ul element:
MENU NOT WORKING:
class="menu sf-menu sf-main-menu sf-horizontal sf-style-none sf-total-items-7 sf-parent-items-2 sf-single-items-5 quantum-superfish-mainmenu"
MENU WORKING:
class="menu sf-menu sf-main-menu sf-horizontal sf-style-none sf-total-items-7 sf-parent-items-2 sf-single-items-5 quantum-superfish-mainmenu superfish-processed sf-js-enabled sf-shadow"
I forced adding these classes through superfish block settings (applying them to the ul), but that doesn't help... So JavaScript files are being loaded, after clear cache first page load shows everything correctly, then it breaks as page is cached and no delay shadow supersubs options are working...
Comment #19
dgtlmoon commentedhack the superfish code and remove the caching just to see if that fixes your problem, if it does, let us know
Comment #20
dmclark commentedI'm having this exact problem
Comment #21
kerberos commented#withdrawn#
Comment #22
eric.chenchao commentedI have also encountered this issue.
It turns out that hook_init() performs setup tasks for non-cached page requests..
So one solution I can imagine is implementing hook_libraires_info() rather than hook_init(). Then using libraries_load() to load superfish js files in the superfish_content().
By doing this we can also gain another benefit that superfish library will be only loaded when superfish blocks show up, not for every page. For example admin pages.
Comment #23
mehrpadin commentedHey Eric,
Are you sure you're using the latest development release?
Comment #24
supriyarajgopal commentedHello,
The random breaking of Superfish menus could also be because of the jQuery Update module.
Disable the module (if installed) & check again.
Thanking you,
Regards,
Supriya Rajgopal
Comment #25
renguer0 commentedI'm facing a similar problem. When I use AdvAgg to minify and unify JS/CSS files, the menu sometimes need a page refresh to update the mobile view (hamburger icon). Desktop version it shows some miliseconds and I think that could be better hiding the rendering of that menu on mobile view.
Maybe there is some workaround for this issue?
EDIT: I'm in D8, lastest dev version.
Comment #26
ivnishrenguer0 please looking for this problem in current issues, if it doesn't exist, create new one for 8.x branch
Comment #27
ivnish