close ad
Help us test the new Databridge BETA with MySQLi support
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

jQuery script in include file

Thread began 11/12/2012 8:49 pm by eric284736 | Last modified 11/13/2012 1:38 pm by Jason Byrnes | 1339 views | 7 replies |

eric284736

jQuery script in include file

Hi Jason,

I have a jquery dropdown menu and it of course contains the call to the jquery latest pack.
Then I have the main page that has a jquery slider. The main page uses the inlude plugin to get the navigation panel, but then the slider does not work because both pages are then calling the same latest pack script.

I tried to include the dropdown code on the main page and reference the include plugin but that does not work. Then I tried to remove the call to the latest pack from the main page thinking it would be called when the navigation panel loaded but that did not work either.

What would you advise?

thx
Eric

Sign in to reply to this post

Jason ByrnesWebAssist

add the call to the script pack on the main page.

make sure it is on the main page in the head section just after the opening head tag.

if you continue to have problems, send a link where i can see it in the browser.

Sign in to reply to this post

eric284736

Thanks Jason!

I added it to just the main page, but just the slider works.

Here is the main page:
wmb/

Here is the include page without the call that is not working:
panel_nav.php

Here is the test include page that is functioning with the drop down:
panel_navDROP.php

Pages are also attached.

thx
Eric

Attached Files
pages.zip
Sign in to reply to this post

Jason ByrnesWebAssist

viewing source of the main page shows the javascript for the menu duplicated:

<script type="text/javascript">
$(document).ready(function(){

$("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled - Adds empty span tag after ul.subnav

$("ul.topnav li a").hover(function() { //When trigger is clicked...

//Following events are applied to the subnav itself (moving subnav up and down)
$(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click

$(this).parent().hover(function() {
}, function(){
$(this).parent().find("ul.subnav").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up
});

//Following events are applied to the trigger (Hover events for the trigger)
}).hover(function() {
$(this).addClass("subhover"); //On hover over, add class "subhover"
}, function(){ //On Hover Out
$(this).removeClass("subhover"); //On hover out, remove class "subhover"
});

});
</script>

<meta charset="utf-8">

<link href="css/main-screen.css" rel="stylesheet" type="text/css">


<script type="text/javascript">
$(document).ready(function(){

$("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled - Adds empty span tag after ul.subnav

$("ul.topnav li a").hover(function() { //When trigger is clicked...

//Following events are applied to the subnav itself (moving subnav up and down)
$(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click

$(this).parent().hover(function() {
}, function(){
$(this).parent().find("ul.subnav").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up
});

//Following events are applied to the trigger (Hover events for the trigger)
}).hover(function() {
$(this).addClass("subhover"); //On hover over, add class "subhover"
}, function(){ //On Hover Out
$(this).removeClass("subhover"); //On hover out, remove class "subhover"
});

});
</script>

make sure that scrip tag only occurs on the navigation page, and not on the main page.

Sign in to reply to this post

eric284736

I removed it completely from the index page so it is only on the navigation page, but the drop down still does not function.

thx
Eric

Sign in to reply to this post

Jason ByrnesWebAssist

the error console is showing errors:

Failed to load resource: the server responded with a status of 404 (Not Found)
dFailed to load resource: the server responded with a status of 403 (Forbidden)
/accounts/wmb/:63TypeError: 'undefined' is not a function (evaluating '$(document)')
/accounts/wmb/:193ReferenceError: Can't find variable: head



it looks like your page is putting jquery into compatibility mode:

//Tell jQuery not to take $
jQuery.noConflict();
//Create a short jQuery reference for convenience
$j = jQuery;

for the slideshow, but the menu is not using compatibility mode. both scripts will need to use compatibility mode, you can have one script using compatibility mode and the other not on the same page.

Sign in to reply to this post

eric284736

You are THE MAN!!

thanks Jason!!!

Sign in to reply to this post

Jason ByrnesWebAssist

glad to hear it is working.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...