PDA

View Full Version : Drill Down Menu : How to select a specific ul on click of a button



sam5
04-19-2013, 07:24 AM
1) Script Title: Drill Down Menu

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

3) Describe problem: I have a button on click of which i get a ul id now i want my drill menu to go to that ul.
I tried this


var mySlider;

$(document).ready(function () {

mySlider = new drilldownmenu({
menuid: 'drillmenu1',
breadcrumbid: 'drillcrumb',
persist: { enable: true, overrideselectedul: true }
});

$('#button1').click(function(){
mySlider.selectedul = 'UL_ID';
});
});

Please help its kindda urgent.

jscheuer1
04-28-2013, 04:47 AM
jQuery(document).ready(function($){

var mySlider = new drilldownmenu({
menuid: 'drillmenu1',
breadcrumbid: 'drillcrumb',
persist: { enable: true, overrideselectedul: true }
});

$('#button1').click(function(){
$('#UL_ID').parent('li').find('a').eq(0).trigger('click');
});
});

Or:


jQuery(document).ready(function($){

var mySlider = new drilldownmenu({
menuid: 'drillmenu1',
breadcrumbid: 'drillcrumb',
persist: { enable: true, overrideselectedul: true }
});

$('#button1').click(function(){
mySlider.slidemenu($('#UL_ID').data('specs').order);
});
});

Or, if you know the 0 based index of the UL you want:


jQuery(document).ready(function($){

var mySlider = new drilldownmenu({
menuid: 'drillmenu1',
breadcrumbid: 'drillcrumb',
persist: { enable: true, overrideselectedul: true }
});

$('#button1').click(function(){
mySlider.slidemenu(2);
});
});

Pick one, do not do two or all three, pick just one of the above methods. They each work by themselves.

You can find out the zero based index of the UL by doing this (after the menu has initialized):


alert(jQuery('#UL_ID').data('specs').order);

The browser cache may need to be cleared and/or the page refreshed to see changes.

If you want more help, please include a link to the page on your site that contains the problematic code so we can check it out.