Sending Menu selection to an Iframe

Home Forums Older releases 0.9.x Sending Menu selection to an Iframe

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1293
    Topshed
    Participant

    Hi,
    I am looking to have my menu in an iFrame and send the menu selection to a second Iframe
    I assume it has something to do with the naming of the 2 iframes

    Any asssistanc e most welcome

    Regards topshed

    #1505
    admin
    Keymaster

    Hi, here is one way to do it:

    1) Set an id e.g. “iframe2” to your second iframe where the links should be loaded.

    2) Add the following JS in your first iframe where the menu is:

    $(function() {
    	$('#main-menu').bind('select.smapi', function(e, item) {
    		var iframe2 = parent.document.getElementById('iframe2');
    		if (iframe2) {
    			iframe2.src = item.href;
    		}
    		return false;
    	});
    });

    That’s all and it would affect all your menu links.

    #1507
    Topshed
    Participant

    Thank you for that but It still loads in iframe1

    My iframe script is

    
     <iframe src="/smartmenus/sm_clean.htm" width="1280" height="85"  name="iframe1" id="iframe1"></iframe>
     <iframe name="iframe2" id="iframe2" width="1280" height="720"></iframe>

    Your code above inserted into iframe1 sm-clean.htm

    
    <!-- "sm-clean" menu theme (optional, you can use your own CSS, too) -->
    <link href="/smartmenus/css/sm-clean/sm-clean.css" rel="stylesheet" type="text/css" />
    $(function() {
    	$('#main-menu').bind('select.smapi', function(e, item) {
    		var iframe2 = parent.document.getElementById('iframe2');
    		if (iframe2) {
    			iframe2.src = item.href;
    		}
    		return false;
    	});
    });
    <!-- #main-menu config - instance specific stuff not covered in the theme -->

    I am lost in here so please explain ?

    Regards Topshed

    #1508
    Topshed
    Participant

    Grrrr
    Iframe script did not reproduce

    
     <body>
     <iframe src="/smartmenus/sm_clean.htm" width="1280" height="85" id="iframe1" name="iframe1"></iframe>
     <iframe name="iframe2" id="iframe2" width="1280" height="720"></iframe>
        </body>
    
    #1509
    Topshed
    Participant

    3rd try no code Pre




    #1514
    Topshed
    Participant

    Okay your fix worked a charmI just need to get my act together

    Thanks Topahed

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

Register

You will be emailed a link to set your password.

Login

Lost password?