Forum Replies Created
-
AuthorPosts
-
March 22, 2016 at 11:25 am in reply to: Brand new to Genesis. jQuery script works on other themes but not on Genesis. #182028
tubescreamer84
MemberShould have known that it was going to be something that simple. So in order for a script like this to work you need to target the child furthest down the chain? Thanks again for solving this for me.
March 21, 2016 at 10:45 am in reply to: Brand new to Genesis. jQuery script works on other themes but not on Genesis. #181982tubescreamer84
MemberI really appreciate your willingness to look into this. However I think I'm still not getting my issue across very well. I'm going to give this one more try. I have updated both the code on the site and the jsFiddle (https://jsfiddle.net/tubescreamer84/poww0xs6/6/ ) with the same exact code which is listed below.
I have also appended the widthVar variable to the .menu element on every iteration of the loop so that you can see it without having to inspect. This can be found on line 20 on both the site and jsFiddle. You should notice that the jsFiddle shows the correct widths of the li elements as they grow from each execution of the loop.
When I run the script on the site this value stays the same and shows the initial combined value of the LI outer widths. This is the part of the script that isn't working as expected. The font size changes on the menu anchor elements is inconsequential. Line 13 and line 20 are the only ones I care about. I need line 20 to function like it does in the jsFiddle and update everytime. This only seems to happen when the Genesis frame work and child themes are active. I have tested this in both the Genesis sample theme and the altitude-pro theme and it happens on both of them.
I hope that this makes sense to you and thank you again for being patient with me.
var fontSize2 = 0; var widthVar =0; while(fontSize2 < 50){ fontSize2 += 1; widthVar = 0; jQuery('.menu li').each(function(){ //THIS LINE IS ANOTHER IMPORTANT LINE widthVar += jQuery('.menu li').outerWidth(); }); console.log("Combined widths of LI's: "+widthVar); //THIS LINE IS THE IMPORTANT LINE jQuery(".menu").after(fontSize2 + "<p>Combined widths of LI's 2: " + widthVar + "</p>"); jQuery('.menu li a').css('font-size',fontSize2 +'px'); }
March 20, 2016 at 5:25 pm in reply to: Brand new to Genesis. jQuery script works on other themes but not on Genesis. #181944tubescreamer84
MemberI want to thank you for looking in to this. However the issue with my script isn't that it doesn't update the font size. It is that the line that calculates the outer width of the parent LI's doesn't use the updated sizes within the loop. If you view the console you will see that the combined widths of the menu LI's is the same for all 25 iterations of the loop.
I created a jsFiddle that shows how the script functions outside of the Genesis framework: https://jsfiddle.net/tubescreamer84/poww0xs6/
If you run this script and then check the console you will see that the output values are incrementing each time the loop is run because the child anchor elements font size is being increased thus making the parent li container grow as well.I need this functionality for a script that dynamically updates the size header menu items that have a center logo. Example can be seen here: http://jeromeblog.malayatech.com when the window is resized the menu items adjust along with it. When I switched to the Genesis framework and sample theme my script quit updating the outWidth on each run of the loop and instead keeps returning the initial width which renders my script useless. I can switch the theme back to Twenty Sixteen or Avada and it runs perfect. Not to mention the jsFiddle also runs as expected.
March 19, 2016 at 11:29 pm in reply to: Brand new to Genesis. jQuery script works on other themes but not on Genesis. #181893tubescreamer84
MemberBump. Has anybody experienced jQuery not functioning correctly within the Genesis framework? This is not a case of getting errors with the script. This is the script working perfectly in one theme and not functioning correctly when genesis is activated.
I'm not looking for a magic solution to my script. Just any information on how Genesis might handle jQuery different from other themes. Anything that might be specific to Genesis.
-
AuthorPosts