work_it_work Posted December 18, 2012 Share Posted December 18, 2012 (edited) i have a jquery / javascript megamenu and i want to modify it, but i don't know anything about java or jquery so please be king enough and help me. the menu is working perfectly but i want to make a little modification to look like i want i cannot upload the file on the forum, so you can find it below: http://www.sendspace.com/file/g5do44 this menu become active when user has mouseover the link(s). All i want to do is to transform one of the link menu to be active all the time there are 4 of this links (categories, account, register, support) the one i want to modify is the "categories" menu i want to display the parent menu when the page is loaded, so the user can see the categories list. all other menus should remain the same (inactive). please help me! thank you! Edited December 18, 2012 by work_it_work Quote Link to comment https://forums.phpfreaks.com/topic/272143-javascript-jeqery-menu-loading-problem-please-help/ Share on other sites More sharing options...
MDCode Posted December 18, 2012 Share Posted December 18, 2012 Do not make people download files. Especially the .rar file you are trying to have people download. Instead post all the code here within code tags Quote Link to comment https://forums.phpfreaks.com/topic/272143-javascript-jeqery-menu-loading-problem-please-help/#findComment-1400122 Share on other sites More sharing options...
work_it_work Posted December 18, 2012 Author Share Posted December 18, 2012 you're funny, how do is suppose to paste all the code here? there are like 6 files. in order the menu to work Quote Link to comment https://forums.phpfreaks.com/topic/272143-javascript-jeqery-menu-loading-problem-please-help/#findComment-1400137 Share on other sites More sharing options...
MDCode Posted December 18, 2012 Share Posted December 18, 2012 (edited) Thanks but I wasn't joking. If anyone downloads anything, a zipped file such as .rar will surely stop them from downloading. Using the text editor when posting there is a button that shows < > which will syntax highlight the code. Or if you don't feel like spamming a post, you can use something like pastebin.com Edited December 18, 2012 by SocialCloud Quote Link to comment https://forums.phpfreaks.com/topic/272143-javascript-jeqery-menu-loading-problem-please-help/#findComment-1400148 Share on other sites More sharing options...
work_it_work Posted December 18, 2012 Author Share Posted December 18, 2012 you didn't understand, how do you suggest to paste the entire code here? if we are talking about 6 files, each one larger then 300 rows? i just uploaded them as an archive and if someone want to help, download the file and see content. anyone this days has an antivirus, and beside that there's no exe file inside. Quote Link to comment https://forums.phpfreaks.com/topic/272143-javascript-jeqery-menu-loading-problem-please-help/#findComment-1400153 Share on other sites More sharing options...
codefossa Posted December 18, 2012 Share Posted December 18, 2012 you didn't understand, how do you suggest to paste the entire code here? if we are talking about 6 files, each one larger then 300 rows? i just uploaded them as an archive and if someone want to help, download the file and see content. anyone this days has an antivirus, and beside that there's no exe file inside. Malicious code can be put in anything. Also, that's not the whole issue. It's easier for people to be able to bring up your source right here rather than download, extract, and look at everything. We are here to help, and it's free .. you're not asked to do anything except give a real attempt, and present the code. If you feel that getting help is not worth the time of posting the code, then that's on you. Most people will not download anything to help. Quote Link to comment https://forums.phpfreaks.com/topic/272143-javascript-jeqery-menu-loading-problem-please-help/#findComment-1400157 Share on other sites More sharing options...
work_it_work Posted December 18, 2012 Author Share Posted December 18, 2012 here is the java code (function($){var AWSGlobalNavDefaults={contentBaseURL:"//localhost",getContentBaseURL: function(){ return $.trim(this.contentBaseURL).replace(/\/+$/g,"");}, }; window.AWSGlobalNav=$.extend({}, AWSGlobalNavDefaults,window.AWSGlobalNav); AWSGlobalNav.returns=(function(){ var $=jQuery; var run=function(){ AWSGlobalNav.DDFO.makeAsyncDDFO();}; return{run:run};})(); AWSGlobalNav.DDFO=( function($){ var DDFO_MOUSELEAVE_TIMEOUT="ddfo-mouseleave-timeout", DDFO_MOUSELEAVE_TIMEOUT_MS=300, DDFO_MOUSEENTER_TIMEOUT="ddfo-mouseenter-timeout", DDFO_MOUSEENTER_TIMEOUT_MS=400, DDFO_MOUSEMOVE_MINOR_DELAY_MS=100, DDFO_MOUSEMOVE_MAJOR_DELAY_MS=250, DDFO_MOUSETRACKER_REGIONS="ddfo-mousetracker-regions", DDFO_OTHER_REF="ddfo-other-ref", DDFO_CLICK_NAMESPACE=".ddfo-click-off", DDFO_ORIG_WIDTH="ddfo-orig-width", DDFO_INDICATOR_CLASS="ddfo-cat-indicator", DDFO_INDICATOR_ACTIVE_CLASS="ddfo-cat-indicator-active", DDFO_BTN_CLASS="ddfo-btn", DDFO_BTN_ACTIVE_CLASS="ddfo-btn-active", DDFO_CAT_LI_CLASS="ddfo-cat-li", DDFO_CAT_LI_ACTIVE_CLASS="ddfo-cat-li-active", DDFO_ATTACH="ddfo-attach", DDFO_ATTACH_RIGHT="right", DDFO_ATTACH_LEFT="left", DDFO_ACTIVE_CAT_ID="ddfo-active-cat-id", DDFO_ACTIVE_CAT_RECT="ddfo-active-cat-rect", DDFO_SHOW_CLASS="ddfo-show", DDFO_ACTIVE="ddfo-active", DDFO_TARGET_SLOP=20, DDFO_DELAYED_CHANGE_TIMEOUT="ddfo-delayed-change-timeout", DDFO_PRIOR_CURSOR="ddfo-prior-cursor", DDFO_IFRAME_SHIM="ddfo-iframe-shim", DISABLED_CLASS="disabled", HIDDEN_FLASH_ELS=[]; var isIE6=$.browser.msie&&parseInt($.browser.version)<=6; var applyButtonSkin=function($ddfoBtn){ var $downArrow=$("<div class='nav-down-arrow nav-sprite'/>");$ddfoBtn.append($downArrow).addClass(DDFO_BTN_CLASS);}; var enterClearLeaveTimeout=function($ddfo){ var timeout=$ddfo.data(DDFO_MOUSELEAVE_TIMEOUT); if(timeout){clearTimeout(timeout);$ddfo.removeData(DDFO_MOUSELEAVE_TIMEOUT);}}; var leaveClearEnterTimeout=function($ddfo){ var timeout=$ddfo.data(DDFO_MOUSEENTER_TIMEOUT); if(timeout){clearTimeout(timeout);$ddfo.removeData(DDFO_MOUSEENTER_TIMEOUT);}}; var hideDDFOAfterTimeout=function($ddfo){ if(!$ddfo.data(DDFO_ACTIVE))return; var timeout=setTimeout(function(){hideDDFO($ddfo);},DDFO_MOUSELEAVE_TIMEOUT_MS);$ddfo.data(DDFO_MOUSELEAVE_TIMEOUT,timeout);}; var hideDDFO=function($ddfo){ if(!$ddfo.data(DDFO_ACTIVE)) return;var $ddfoBtn=$ddfo.data(DDFO_OTHER_REF); $ddfoBtn.removeClass(DDFO_BTN_ACTIVE_CLASS); $ddfo.removeClass(DDFO_SHOW_CLASS).data(DDFO_ACTIVE,false); $ddfo.find("."+DDFO_INDICATOR_ACTIVE_CLASS).removeClass(DDFO_INDICATOR_ACTIVE_CLASS); $(document).unbind(DDFO_CLICK_NAMESPACE); $ddfo.css({width:$ddfo.data(DDFO_ORIG_WIDTH)+"px"}); $ddfo.css({width:"210px"}); teardownCatShowAndChange($ddfo); $ddfo.css({overflow:"hidden"});showFlash(); if(isIE6){ var $iframeShim=$ddfo.data(DDFO_IFRAME_SHIM);if($iframeShim){$iframeShim.hide();}}}; var showDDFOAfterTimeout=function($ddfo){ if($ddfo.data(DDFO_ACTIVE))return; var timeout=setTimeout(function(){showDDFO($ddfo);},DDFO_MOUSEENTER_TIMEOUT_MS);$ddfo.data(DDFO_MOUSEENTER_TIMEOUT,timeout);}; var hideFlash=function(){$("object:visible, iframe:visible").css("visibility","hidden").each(function(){HIDDEN_FLASH_ELS.push($(this));});}; var showFlash=function(){$.each(HIDDEN_FLASH_ELS,function(index,$el){$el.css("visibility","visible")});HIDDEN_FLASH_ELS=[];}; var showDDFO=function($ddfo){ if($ddfo.data(DDFO_ACTIVE)) return;$(".ddfo").each(function(){hideDDFO($(this));});hideFlash();$(document).bind("click"+DDFO_CLICK_NAMESPACE,function(e){hideDDFO($ddfo);}); var $ddfoBtn=$ddfo.data(DDFO_OTHER_REF); var ddfoOuterWidth=$ddfo.outerWidth(); var ddfoTotalBorderWidth=pxToInt($ddfo.css("borderRightWidth"))+pxToInt($ddfo.css("borderLeftWidth")); var ddfoBtnOuterWidth=$ddfoBtn.outerWidth();if(ddfoOuterWidth<ddfoBtnOuterWidth){ var newWidth=ddfoBtnOuterWidth-ddfoTotalBorderWidth;$ddfo.css({width:newWidth});$ddfo.data(DDFO_ORIG_WIDTH,newWidth);} else{$ddfo.data(DDFO_ORIG_WIDTH,ddfoOuterWidth-ddfoTotalBorderWidth);} var newTop=$ddfoBtn.position().top+$ddfoBtn.outerHeight()-1,attach=$ddfo.data(DDFO_ATTACH),newPos; if(attach===DDFO_ATTACH_RIGHT){newPos={"left":$ddfoBtn.position().left+pxToInt($ddfoBtn.css("marginLeft"))-($ddfo.outerWidth()-$ddfoBtn.outerWidth()),"top":newTop};} else{newPos={"left":$ddfoBtn.position().left+pxToInt($ddfoBtn.css("marginLeft")),"top":newTop};} $ddfoBtn.addClass(DDFO_BTN_ACTIVE_CLASS);$ddfo.css(newPos).addClass(DDFO_SHOW_CLASS).data(DDFO_ACTIVE,true); if(isIE6){ var $iframeShim=$ddfo.data(DDFO_IFRAME_SHIM); if(!$iframeShim){$iframeShim=$("<iframe src='javascript:false;' frameborder='0' scrolling='no' />").css({ border:0,display:"none",zIndex:(parseInt($ddfo.css("zIndex"))-1)||-1, position:"absolute", filter:"progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)"}).insertAfter($ddfo);$ddfo.data(DDFO_IFRAME_SHIM,$iframeShim);} $iframeShim.css(newPos).css({width:$ddfo.outerWidth(),height:$ddfo.outerHeight()}).show();} if($ddfo.find("."+DDFO_CAT_LI_CLASS).length>0){ if($ddfo.find("."+DDFO_INDICATOR_CLASS).length===0){ var $indicator=$("<div class='nav-sprite'/>").addClass(DDFO_INDICATOR_CLASS);$ddfo.append($indicator);} setupCatShowAndChange($ddfo);}}; var mouseTracker=function(){ var regions=[],n=3,cursor=[{x:0,y:0}],c=0,scroll=[0,0],listening=false; var callbackArgs=function(){ var pCursors=[]; for(var i=1;i<n;i++){pCursors.push(cursor[(c-i+n)%n]);} return $.extend(true,{},{cursor:cursor[c],priorCursors:pCursors});} var check=function(immediately){ for(var i=0;i<regions.length;i++){ var r=regions[i]; var inside=$.grep(r.rects,function(n){ return cursor[c].x>=n[0]&&cursor[c].y>=n[1]&&cursor[c].x<n[0]+n[2]&&cursor[c].y<n[1]+n[3];}).length>0; if(r.inside!==null&&inside&&!r.inside&&r.mouseEnter){r.inside=r.mouseEnter(callbackArgs());} else if(r.inside!==null&&!inside&&r.inside&&r.mouseLeave){r.inside=!r.mouseLeave(immediately,callbackArgs());}}} var startListening=function(){scroll=[$(window).scrollLeft(),$(window).scrollTop()]; $(document).mousemove(function(e){c=(c+1)%n;cursor[c]={x:e.pageX,y:e.pageY};check();}); $(document).scroll(function(e){cursor[c].x+=($(window).scrollLeft()-scroll[0]); cursor[c].y+=($(window).scrollTop()-scroll[1]);scroll=[$(window).scrollLeft(),$(window).scrollTop()];check();});listening=true;} return{add:function(rectsArray,options){if(!listening){startListening();} var r=$.extend({rects:rectsArray},options);regions.push(r); return r;},remove:function(region){ for(var i=0;i<regions.length;i++){ if(regions[i]===region){regions.splice(i,1); return;}}},checkNow:function(){check(true);},getCallbackArgs:function(){ return callbackArgs();}};}(); var rectRelation=function(cursor,rect){ var h='c',v='c'; if(cursor&&rect){ if(cursor.x<rect.x1)h='l'; else if(cursor.x>rect.x2)h='r'; if(cursor.y<rect.y1)v='t'; else if(cursor.y>rect.y2)v='b';} return v+h;}; var notInRect=function(cursor,rect){ return rectRelation(cursor,rect)!=='cc';}; var calcChangeDelay=function(args,rect){ var delay=0,c=args.cursor,p1=args.priorCursors[0]||{},p2=args.priorCursors[1]||{}; if(c.x==p1.x&&Math.abs(c.y-p1.y)<2&&c.x>p2.x){delay=DDFO_MOUSEMOVE_MINOR_DELAY_MS;} else{ var r=rect,pts=[c,p1]; switch(rectRelation(c,r)){ case'tl':pts.push({x:r.x1,y:r.y2},{x:r.x2,y:r.y1}); break; case'bl':pts.push({x:r.x1,y:r.y1},{x:r.x2,y:r.y2}); break; case'cl':pts.push({x:r.x1,y:r.y1},{x:r.x1,y:r.y2}); break; default:pts.push({x:0,y:0},{x:0,y:0});delay=-1;} if(delay==0){ var b0=(pts[2].x-pts[1].x)*(pts[3].y-pts[1].y)-(pts[3].x-pts[1].x)*(pts[2].y-pts[1].y),b1=((pts[2].x-pts[0].x)*(pts[3].y-pts[0].y)-(pts[3].x-pts[0].x)*(pts[2].y-pts[0].y))/b0,b2=((pts[3].x-pts[0].x)*(pts[1].y-pts[0].y)-(pts[1].x-pts[0].x)*(pts[3].y-pts[0].y))/b0,b3=((pts[1].x-pts[0].x)*(pts[2].y-pts[0].y)-(pts[2].x-pts[0].x)*(pts[1].y-pts[0].y))/b0;delay=(b1>0&&b2>0&&b3>0?DDFO_MOUSEMOVE_MAJOR_DELAY_MS:0);}} return delay;}; var setupCatShowAndChange=function($ddfo){$ddfo.find("."+DDFO_CAT_LI_CLASS).each(function(){ var $catLi=$(this),catId=$catLi.attr("id"); var mouseEnter=function(args){clearTimeout($ddfo.data(DDFO_DELAYED_CHANGE_TIMEOUT)); var activeCatId=$ddfo.data(DDFO_ACTIVE_CAT_ID); if(activeCatId!==catId){ var changeDelay=calcChangeDelay(args,$ddfo.data(DDFO_ACTIVE_CAT_RECT)); if(activeCatId&&changeDelay>0){ var doDelayedChange=function(){clearTimeout($ddfo.data(DDFO_DELAYED_CHANGE_TIMEOUT)); var delayedArgs=mouseTracker.getCallbackArgs(),delayedDelay=0,priorCursor=$ddfo.data(DDFO_PRIOR_CURSOR),subcatRect=$ddfo.data(DDFO_ACTIVE_CAT_RECT); if(priorCursor&&priorCursor.x==delayedArgs.cursor.x&&priorCursor.y==delayedArgs.cursor.y){ if(notInRect(delayedArgs.cursor,subcatRect))delayedDelay=0; else delayedDelay=-1;} else{delayedDelay=calcChangeDelay(delayedArgs,subcatRect);} $ddfo.data(DDFO_PRIOR_CURSOR,{x:delayedArgs.cursor.x,y:delayedArgs.cursor.y});if(delayedDelay>0){ var activeCatId=$ddfo.data(DDFO_ACTIVE_CAT_ID); if(activeCatId!==catId){$ddfo.data(DDFO_DELAYED_CHANGE_TIMEOUT,setTimeout(doDelayedChange,delayedDelay));}} else if(delayedDelay>-1){$ddfo.data(DDFO_ACTIVE_CAT_RECT,showDDFOCat($catLi,$ddfo));}}; $ddfo.data(DDFO_DELAYED_CHANGE_TIMEOUT,setTimeout(doDelayedChange,changeDelay));} else{$ddfo.data(DDFO_ACTIVE_CAT_RECT,showDDFOCat($catLi,$ddfo));}} return true;}; var mouseLeave=function(immediately,args){return true;}; var catLiOffset=$catLi.offset(),added=mouseTracker.add([[catLiOffset.left,catLiOffset.top,$catLi.outerWidth(),$catLi.outerHeight()]], {inside:false,mouseEnter:mouseEnter,mouseLeave:mouseLeave}), mtRegions=$ddfo.data(DDFO_MOUSETRACKER_REGIONS)||[];mtRegions.push(added); $ddfo.data(DDFO_MOUSETRACKER_REGIONS,mtRegions);});}; var teardownCatShowAndChange=function($ddfo){clearTimeout($ddfo.data(DDFO_DELAYED_CHANGE_TIMEOUT)); var mtRegions=$ddfo.data(DDFO_MOUSETRACKER_REGIONS); if(mtRegions){ for( var i=0;i<mtRegions.length;i++){mouseTracker.remove(mtRegions[i]);} mtRegions=[];$ddfo.data(DDFO_MOUSETRACKER_REGIONS,mtRegions);$ddfo.css({width:"210px"});} $ddfo.removeData(DDFO_ACTIVE_CAT_ID);$ddfo.find("."+DDFO_CAT_LI_ACTIVE_CLASS).removeClass(DDFO_CAT_LI_ACTIVE_CLASS);}; var pxToInt=function(string){ return parseInt(string.replace("px",""))||0;} var showDDFOCat=function($catLi,$ddfo){ var id=$catLi.attr("id"); var $subcatItem=$("#"+id+"-item"); var $indicator=$ddfo.find("."+DDFO_INDICATOR_CLASS);if($ddfo.data(DDFO_ACTIVE_CAT_ID)===id) return;$catLi.parent().parent().children().find("."+DDFO_CAT_LI_ACTIVE_CLASS).removeClass(DDFO_CAT_LI_ACTIVE_CLASS);$catLi.addClass(DDFO_CAT_LI_ACTIVE_CLASS); var catLiTopBorder=pxToInt($catLi.css("border-top-width")); var catLiTopMargin=pxToInt($catLi.css("margin-top")); var catLiTopPadding=pxToInt($catLi.css("padding-top")); var catLiLineHeight=pxToInt($catLi.css("line-height")); var catLiFontSize=pxToInt($catLi.css("font-size")); var catLiExtra=Math.round((catLiLineHeight-catLiFontSize)/2); $indicator.css({top:$catLi.position() .top+catLiTopBorder+catLiTopMargin+catLiTopPadding+catLiExtra,left: $catLi.position().left+$catLi.outerWidth()}).addClass(DDFO_INDICATOR_ACTIVE_CLASS); $subcatItem.siblings().removeClass(DDFO_SHOW_CLASS);$subcatItem.addClass(DDFO_SHOW_CLASS); var newDDFOProps={width:$ddfo.data(DDFO_ORIG_WIDTH)+$subcatItem.parent().outerWidth()}; if($ddfo.data(DDFO_ACTIVE_CAT_ID)){$ddfo.stop(true,true).css(newDDFOProps);} else{$ddfo.stop(true,true).not(':animated').animate(newDDFOProps,{speed:"fast",complete:function(){$(this).css({overflow:"visible"})}});} if(isIE6){ var $iframeShim=$ddfo.data(DDFO_IFRAME_SHIM); if($iframeShim){ var extraBorderWidth=pxToInt($ddfo.css("border-left-width"))+pxToInt($ddfo.css("border-right-width")); var newShimWidth=newDDFOWidth.width+extraBorderWidth;$iframeShim.css({width:newShimWidth});}} $ddfo.data(DDFO_ACTIVE_CAT_ID,id); var subCatOffset=$subcatItem.offset(), x1=subCatOffset.left,y1=subCatOffset.top-DDFO_TARGET_SLOP, x2=x1+$subcatItem.outerWidth(), y2=y1+$subcatItem.outerHeight()+DDFO_TARGET_SLOP; return{x1:x1,y1:y1,x2:x2,y2:y2};}; var computeSrcURL=function(options){ var baseURL=AWSGlobalNav.getContentBaseURL(); if(options.useLangSrc){retval=baseURL+options.src;} else{retval=baseURL+options.src;} return retval;} var createJSONPSuccessCallback=function(options){ return function(data){ var $ddfoBtn=options.ddfoBtn;$ddfoBtn.click(function(e){e.preventDefault();});applyButtonSkin($ddfoBtn); var $ddfo=$("<div class='ddfo'/>").append(data); $ddfoBtn.parent().append($ddfo); $ddfoBtn.data(DDFO_OTHER_REF,$ddfo); $ddfo.data(DDFO_OTHER_REF,$ddfoBtn); $ddfo.data(DDFO_ATTACH,options.attach); options.extraSuccessCallback($ddfo);};}; var jsonpErrorHandler=function(error){log("An error ocurred while retrieving DDFO menu content from "+error.url);}; var makeAsyncDDFO= function(options){ var defaultOptions={attach:DDFO_ATTACH_LEFT,useLangSrc:true,extraSuccessCallback:function(){ return true;}},src; options=$.extend(defaultOptions,options); $.jsonp({url:computeSrcURL(options),callback:"displayIn", cache:true,pageCache:false,success:createJSONPSuccessCallback(options),error:jsonpErrorHandler});}; var run=function(){$("#main-nav").delegate("."+DDFO_BTN_CLASS,"click mouseenter mouseleave", function(e){ var $ddfoBtn=$(this); var $ddfo=$ddfoBtn.data(DDFO_OTHER_REF); if($ddfoBtn.hasClass(DISABLED_CLASS)) return false; switch(e.type){ case"click":showDDFO($ddfo);e.stopPropagation(); break; case"mouseenter":enterClearLeaveTimeout($ddfo); showDDFOAfterTimeout($ddfo); break; case"mouseleave":leaveClearEnterTimeout($ddfo);hideDDFOAfterTimeout($ddfo); break; default:break;}}).delegate(".ddfo","click mouseenter mouseleave", function(e){ var $ddfo=$(this); switch(e.type){ case"click":e.stopPropagation(); break; case"mouseenter":enterClearLeaveTimeout($ddfo); break; case"mouseleave":hideDDFOAfterTimeout($ddfo); break; default:break;}}); makeAsyncDDFO({ddfoBtn:$("#nav-dd-products-solutions"),attach:DDFO_ATTACH_LEFT,src:"/m11/"}); makeAsyncDDFO({ddfoBtn:$("#nav-dd-developers"),attach:DDFO_ATTACH_RIGHT,src:"/m21/"}); makeAsyncDDFO({ddfoBtn:$("#nav-dd-support"),attach:DDFO_ATTACH_RIGHT,src:"/m31/"}); makeAsyncDDFO({ddfoBtn:$("#gtl-dd-account-console"),attach:DDFO_ATTACH_RIGHT,src:"/m41/"}); makeAsyncDDFO({ddfoBtn:$("#gtl-dd-account-consoles"),attach:DDFO_ATTACH_RIGHT,src:"/m41/"});}; return{run:run,makeAsyncDDFO:makeAsyncDDFO};})(jQuery); AWSGlobalNav.Search=( function($){ var EXTRA_RIGHT_PADDING=6, SEARCH_IN_CONFIG={en:{ defaulLabel:'Search In', pathSelect:{all:'Entire Site', amis:'AMIs',articles:'Articles & Tutorials',products_and_info:'AWS Product Information',case_studies:'Case Studies', customerapps:'Customer Apps',developertools:'Developer Tools',documentation:'Documentation',datasets:'Public Data Sets', releasenotes:'Release Notes',solution_providers:'Partners',code:'Sample Code & Libraries',AWSMarketplace:'AWS Marketplace'}}}; var wrapStringInFunc=function(string){ return function(){ return string;};}; var PATH_CONFIG=[[new RegExp('^/$'),wrapStringInFunc("all")],[new RegExp("^/search(?=/|$)"), function(){ var searchPath=AWSGlobalNav.searchCategory,pathSelect=getConfig("pathSelect"); return(searchPath&&pathSelect.hasOwnProperty(searchPath))?searchPath:"all"}], [new RegExp("solution-providers"),wrapStringInFunc("solution_providers")], [new RegExp("/case-studies"),wrapStringInFunc("case_studies")], [new RegExp('^/([^/]+)'),function(matches){var pathSelect=getConfig("pathSelect") rootPath=matches[1]; return(pathSelect.hasOwnProperty(rootPath))?rootPath:null;}], [new RegExp(".*"),wrapStringInFunc("all")]]; var getConfig=function(key){ var config=SEARCH_IN_CONFIG["en"]; return config[key];}; var createSelectMenu=function(){ var $select=$("#nav-search-dropdown"),searchPath=getSearchPathFromURI();$.each(getConfig("pathSelect"), function(k,v){$select.append($("<option/>").val(k).html(v));}); if(searchPath){searchCategoryUpdater($select,searchPath,0,4,1000);}}; var searchCategoryUpdater=function($select,searchPath,retryCount,maxRetries,pauseTimeMS){ try{$select.val(searchPath);updateSearchInContent();} catch(e){ if(retryCount<maxRetries){setTimeout( function(){searchCategoryUpdater($select,searchPath,retryCount+1,maxRetries,pauseTimeMS);},pauseTimeMS);}}}; var getSearchPathFromURI=function(){ var uri=window.location.pathname,searchPath; $.each(PATH_CONFIG,function(index,config){ var matches=config[0].exec(uri); if(matches){searchPath=config[1](matches); return(searchPath==null);}}); return searchPath;}; var updateSearchInContent=function(){$("#nav-search-in-content").text($("#nav-search-dropdown option:selected").text()); var newPaddingRight=$("#nav-search-in").outerWidth()+EXTRA_RIGHT_PADDING;$("#nav-searchfield-width").css({paddingRight:newPaddingRight});}; var bindChangeHandler=function(){$("#nav-search-dropdown").change(function(){updateSearchInContent();});}; var run=function(){createSelectMenu();bindChangeHandler();}; return{run:run};})(jQuery); $(function(){AWSGlobalNav.DDFO.run(); AWSGlobalNav.Search.run(); });})(jQuery); do i have to add anything else? Quote Link to comment https://forums.phpfreaks.com/topic/272143-javascript-jeqery-menu-loading-problem-please-help/#findComment-1400158 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.