Start a new discussion

To start a new discussion please visit the discussions section of the GitHub home page of the project.

Discussions on GitHub

You can also search our old self-hosted forums for any useful information below but please note that posting new content here is not possible any more.

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)
  • The forum ‘0.9.x’ is closed to new topics and replies.