Saturday, 15 March 2014

Conflicting jQuery scripts between expanding menu and expandable/collapsible list -



Conflicting jQuery scripts between expanding menu and expandable/collapsible list -

i working on redesign responsive website. have run problem when have particular jquery files linked in page.

the first file mobile menu @ top, shows 3 lines , when click them expands downwards show menu.

the sec script 1 using collapsible list.

the problem arises when both included menu expanded, instead of expanding when clicked. collapsible list functions how should.

i have used both scripts on same page in past without issues, using .asp pages instead of .html didn't think should matter?

here re-create of first script menu:

(function ($, window, document, undefined) { 'use strict'; $(function () { $("#mobilemenu").hide(); $(".togglemobile").click(function() { $(this).toggleclass("active"); $("#mobilemenu").slidetoggle(500); }); }); $(window).on("resize", function() { if($(this).width() > 500) { $("#mobilemenu").hide(); $(".togglemobile").removeclass("active"); } }); })(jquery, window, document);

and script collapsible list:

$(function preparelist() { $('#explist').find('li:has(ul)').unbind('click').click(function(event) { if(this == event.target) { $(this).toggleclass('expanded'); $(this).children('ul').toggle('medium'); } homecoming false; }).addclass('collapsed').removeclass('expanded').children('ul').hide(); //hack add together links within cv $('#explist a').unbind('click').click(function() { window.open($(this).attr('href'),'_self'); homecoming false; }); //create button functionality $('#expandlist').unbind('click').click(function() { $('.collapsed').addclass('expanded'); $('.collapsed').children().show('medium'); }) $('#collapselist').unbind('click').click(function() { $('.collapsed').removeclass('expanded'); $('.collapsed').children().hide('medium'); }) }); //functions execute on loading document $(document).ready( function() { preparelist() });

i have messed around bit seek isolate problem able find if take off first line of sec script,

$(function preparelist()

the menu go working correctly, collapsing list of course of study stop.

if have ideas seek out appreciate it!

jquery

No comments:

Post a Comment