PDA

View Full Version : Side Push Menu v1.1 external txt file option not working



green
11-22-2016, 01:09 PM
1) Script Title: Side Push Menu v1.1

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/pushmenu.htm

3) Describe problem: I have script working properly when I put markup inside the page (inline) but I want the external file option as described in the instructions such as: mymenu.txt. I have made a .txt file with that name and placed it in the same folder as the other html pages. When I try it I get the error message from the js file.

The contents of the mymenu.txt file are:

<nav id="pushmenu1" class="pushmenu">
<h2>La gramática inglesa: explicaciones y ejercicios...</h2>
<ul class="mainnav">
<h2>Navigation...!</h2>
<p><a href="">Índice de cartas y emails bilingües ejemplos inglés español</a></p>
<p> etc etc. </p>
</ul>
</nav>

In the head of the html page I have:

<script>
jQuery(function(){ // on DOM Load
var menu1 = pushmenu({
menuid: 'pushmenu1',
position: 'left',
source: 'mymenu.txt'
})
})
</script>

As I say, if I just place the contents of mymenu.txt inline and take out: source: 'mymenu.txt', it all works (so js and css files working ok) but I want the external file option.

Something silly I'm doing wrong. Can you help?

Mike

molendijk
11-22-2016, 01:43 PM
Try the following:
1. Remove this code from the html-page:

<script>
jQuery(function(){ // on DOM Load
var menu1 = pushmenu({
menuid: 'pushmenu1',
position: 'left',
source: 'mymenu.txt'
})
})
</script>
2. In the nav-section put:
<nav id="pushmenu1" class="pushmenu">
<script>
$('#pushmenu1').load('mymenu.txt')
</script>
</nav>
That should do it.

green
11-23-2016, 10:56 AM
Thanks, Molendijk

Actually, I got the previous code to work in the end but it didn't work in Chrome on my hard drive but only when loaded up to the web. Fortunately, with MF it works on my hard drive too. Thanks for helping out.

Mike