PERFECT!
Just made your corrections and removed the mouse leave function, and the clicking of the child document hides the menu.
Another instance of when this script will help (on a PC not mobile) is if someone were to tab out of the window while the menu is open and then tab back to it. It would not trigger the mouse leave and there for would keep the menu open. Now a simple click of the child document will close the menu....
User Profile
Collapse
-
thekingsnake replied to Script in an IFRAME not calling particular function defined in the parent document?in JavascriptGood call. I was just thinking, I am still going to need this script for when people navigate to my site on something without a mouse, like a mobile.
I just changed the child to:
with no luck. Same error in FF, Error: parent.myMenuHi de is undefined.Code:<body onclick="parent.myMenuHide.apply(parent, event);">
this is the parents <head> take a look and see if I've messed up the global function:...Leave a comment:
-
thekingsnake replied to Script in an IFRAME not calling particular function defined in the parent document?in JavascriptHey Gits,
Thanks for All your hard work. The person who I got this menu bar from has finally answered my question directly. Apparently the exact thing we were trying to do, but much simpler to achieve was actually a feature of this jQuery script.
You simply add this to your function:
...Code:menu .mouseleave( function(){ // Toggle the menu display. menu.hide();Leave a comment:
-
thekingsnake replied to Script in an IFRAME not calling particular function defined in the parent document?in JavascriptGave it a shot. Not sure if I incorporated it correctly but I still end up with an error in FF.
I simply added this in the <head> of the parent:
and used this for the childs <body>:Code:function myMenuHide() { $( "#menu" ).hide(); }
Am I just doing this wrong?Code:<body onclick="parent.MenuHide.apply(parent, event);">
Perhaps we can try this...Leave a comment:
-
thekingsnake replied to Script in an IFRAME not calling particular function defined in the parent document?in JavascriptTried to create a global var, but i don't think i did it right.
I just put this within the <head> tags but did not know if I was suposed to put any tags around it:
This is what the parents content looks like between the <head>...Code:var menuhide = $( "#menuhide" ); menuhide function(){ // Toggle the menu display when link clicked. menu.hide(); } ;Leave a comment:
-
thekingsnake replied to Script in an IFRAME not calling particular function defined in the parent document?in JavascriptAhh, there is. Never knew FF had a console.
Error: parent.menu is undefinedLeave a comment:
-
thekingsnake replied to Script in an IFRAME not calling particular function defined in the parent document?in JavascriptI think I understand that.
Will I be able to use it in the body tag like I did here:
I'm rather new at trying to do this advanced stuff. I believe I am to put the name of the function I wish to execute in place of your "functionNa me", right?Code:<body onclick="parent.FUNCTION NAME HERE()">
Next I'm not sure how to use the "function name" I'm trying to apply.
...Leave a comment:
-
thekingsnake replied to Script in an IFRAME not calling particular function defined in the parent document?in JavascriptIt's actually an iFrame that is 100% wide and high with the menu in the parent. I figured if I were to use regular frames it would not allow the menu to be seen past the frames edge.
I've tried adding the click to "hide" menu feature to the child document but there is now menu in that document for it to "hide".
What I was trying to was have the child document execute a function from the parent document...Leave a comment:
-
thekingsnake replied to Script in an IFRAME not calling particular function defined in the parent document?in Javascriptre: Script in an IFRAME not calling particular function defined in the parent documen
Here is the script that I am currently using for the menu to open and the "click" hide feature.
This menu feature comes from the following help:
http://www.bennadel.co m/blog/1740-Building-A-Fixed-Position-Bottom-Menu-Bar-ala-FaceBook-.htm
...Code:<script type="text/javascript"> jQuery(function(
Leave a comment:
-
thekingsnake replied to Script in an IFRAME not calling particular function defined in the parent document?in JavascriptCurrently it "hides" only when you choose one of the menu items, but it does not "hide" when you CLICK on your curent page. If you could figure out how to get it to "hide" on a "mouse out" that would be the better option.
I attempted this method however i could only get it to "toggle" the menu on "mouse out". This method does however create an annoying flicker when you hover...Leave a comment:
-
thekingsnake started a topic Script in an IFRAME not calling particular function defined in the parent document?in JavascriptScript in an IFRAME not calling particular function defined in the parent document?
After following the instructions from the answer below:
http://bytes.com/topic/javascript/answers/153274-script-iframe-can-not-call-functions-defined-parent-document
I was able to have the child window perform the function in the parent window.
The function was to only have an alert window pop up as the child page was loading.
I easily modified this to my intention which was to have...
No activity results to display
Show More
Leave a comment: