Navigation: Find / Get Parent Category

Jan 1, 2011

I have been working on this navigation for something to do, and I cannot for the life of me figure out how to get the parent category. Here is an example of my navigation:

[Code]....

So it will produce a sub-menu with other jQuery that I worked out. So, what I am trying to figure out is when you click on "Project 003" I want JavaScript (or jQuery) to find what menu-item it belongs to, so in this case "#mi". I know I have to go 2 parents up (li, li), but I can't figure out how to get back down into the anchor to use the .attrib('href') function.

View 2 Replies


ADVERTISEMENT

Array Access Which Contains Category Info For Navigation

Mar 15, 2010

I have a multidimensional associative array in JS which contains category information for a navigation. It's actually set up through PHP, which pulls the info from a database then translates it into JS. I know it's set up correctly since I can see it in the source once the page is rendered. However, accessing this array causes external JS code (from my Slimbox files) to be displayed in the nav. It's as if the array is set up right, but accessing the elements brings in Slimbox code as the elements. It's very strange. You can see the effect here.

It's the secondary nav under Home, Featured Items, etc. Each token that is clickable is separated by an asterisk: [URL]. Notice the other page's navs work great! Try the jewelry nav on the Home page and the categories are set up fine. This is because other pages do not link to Slimbox. (And no, the site aint pretty because I wanted to get the hard stuff working before I work on the look). I've heard of jQuery interfering with Slimbox and Lightbox, but my nav is not using jQuery!

View 9 Replies View Related

JQuery :: Make A Two Part Navigation Menu (main/sub Category)

Jun 4, 2011

My goal right now is to make a two-part navigation bar where you don't have to reload the whole site, when you click on a link. The navigation bar consists of two <ul> lists with <li> float:left and <a> display:block, so I basically have two lines. It's probably easier to understand if you see it for yourself: jsfiddle (had to change the css style, because I use .less but it works)

When you load the page it's just like that, you have your main category (A,B,C,D,...) and the sub-category (A1,A2,A3,...). What I want: If you click on B, the sub category changes to B1,B2,.... If you click on a sub category the site loads the requested page (with ajax = best solution?!)

My thoughts

At first I thought about just changing the name and href attribute of the second list, but the main categories have different amounts of sub categories, so I would need to add or remove <li>'s. Then I thought about using .load() but I somehow screwed up (of course) and the loaded <ul> doesn't have any css style (wrong order?) and I can't see anything. (with a loaded test.html site containing only the word "test" it worked) Is ajax "overkill" as a solution?

CodeIgniter and the URL

I use CodeIgniter (a PHP framework) for the website and URLs like this: www.example.com/maincategory/subcategory (e.g. example.com/A/A3) That's no problem at all, if I don't use any javascript and reload the whole site every time. But is it possible to change the URL with jQuery when the user clicks through the navigation bar? You click on B, the URL changes to example.com/B all the subcategories change to B1,B2,...When you click on B2 the URL changes to example.com/B/B2 and the site loads the requested page (I guess with ajax, so the navigation stays the same?!)

Minor problem: when you load the site, click on B, then B3 for example, you would get the url example.com/B/B3. If you now save this link, close the site and reopen it with the link, CodeIgniter would load the right site and everything, but the navigation would show A1,A2,.. in the sub category.

Hover vs click

Almost every page where I saw this kind of menu they used hover to change the sub category. But I thought click would be better, so you don't have to avoid touching B,C,D,.. if you want to go from A to A9 for example. Only downside is that you have to click before you see the sub categories.

Summary

A two part navigation menu you can use without reloading, changing URLs (when possible) and probably ajax to load the actual content.

View 2 Replies View Related

Selecting Category Details And Products Linked With The Same Category

Feb 4, 2011

i want to list car category name and car details in a single page but the result is car details are same for every category.

[Code]...

View 1 Replies View Related

JQuery :: Navigation Menu - Click Should Only Work On Parent UL

Apr 29, 2010

I've a navigation menu that has some sub-menus and I want to show them only after a click on the parent link. But every click on the sub-menu collapse the menu again.

$('ul#nav>li:has(ul)').click(function() {
$(this).children('ul').slideToggle();
return false;
});
<ul id="nav">
<li><a href="#Home">Home</a></li>
<li><a href="#Products">Products</a>
<ul>
<li><a href="#Apples">Apples</a></li>
<li><a href="#Bananas">Bananas</a></li>
</ul></li>
<li><a href="#Services">Services</a></li>
</ul></div>

When I click Products and than Apples it hides the level 2 UL. But it should go to #Apples instead. I can not change the HTML since it comes out of a CMS. So I have to deal with that structure. How can I prevent the level 2 UL collapses when I click on Apples or Bananas?

View 1 Replies View Related

JQuery :: Way To Find Parent ID

Feb 24, 2010

I know this might seem like a newb question,

but the following returnsnothingfor me, except a blank alert box...[code]...

View 3 Replies View Related

JQuery :: Find Parent's Tag Name?

Mar 26, 2010

I want to check if the image wrapped by a tag, so I write the [code]...

View 2 Replies View Related

JQuery :: Find Parent Of A Comment?

Dec 20, 2010

I wonder if there's any chance to get the parent's ID of an html comment.

Let's say I have the following comment inside the DOM[code]...

And I would like to know where is it contained asking for it literally.

I have tried with :contains("<!--this is a comment-->") but contains doesn't seems to support comments.

View 1 Replies View Related

JQuery :: How To Find A Parent Element

Aug 13, 2009

I want to find the parent element of some element.

$("tr input").each(function (i) { //loop input elements within tr's
if(this.name == "cid[]"){
//checkbox

[code]....

View 2 Replies View Related

JQuery :: Correctly Find Elements In DOM Using Parent()?

Apr 11, 2010

I am doing this code that has multiple elements of the same type.... to select the parent DIV I had to use this code:

$(this).parent().parent().parent().parent().append($('#grid_show_columns'));

How can I do it without using that many parent() ?

View 4 Replies View Related

JQuery :: How To Find Parent Node In JSON

Dec 30, 2010

How To Find The Parent Node of any item in JSON Data

View 1 Replies View Related

JQuery :: Efficient Way To Find A Parent For A Button?

May 5, 2009

I want to find a parent for a button. I have set up the html like the following.[code]...

View 2 Replies View Related

Jquery :: Find The Parent Div - Of Input Field?

Jul 8, 2009

I have a div within the div a table with input field

Code:
<div id='main' >
<table id='tabReg' >
<tr>
<td><input type="text" name="abc" id="abc" /></td>
</tr>
</div>

How i can find the parent div of this input field for example someone type into the input field on keyup we want to find the parent div of this input field

View 1 Replies View Related

JQuery :: Find The Index Of The Parent Of A Specific Element?

May 14, 2009

My question is quite simple with an example:

[Code]...

View 1 Replies View Related

JQuery :: Space Between Category/subcategory?

Oct 12, 2009

i'm trying to create a tree menu, each time i click into a category it shows me the subcategories.My code works fine but i have some spaces between a category and his subcategories, it's not a css problem

[Code]...

View 6 Replies View Related

Interactive Category Picker/selector?

Sep 13, 2011

how one could create a category picker just like gumtree (preferably in jquery):Specifically the points How clicking on a category opens another to the right How clicking on a category appends a variable like "#cat-10201" into the url (and vice versa) How css lists are used instead of form select menus (making it easily styled) How clicking on a deep subcategory automatically preselects all parent categoriesI'm not looking for anyone to actually code it for me (that would be outrageous :p) but tips on how it's actually structured and steps on how it can be coded I can do PHP and I know CSS also

View 1 Replies View Related

Zip Code / Category Based Search For Results?

Aug 24, 2010

I'm looking for a script or applet that will allow users to search by zipcode or selected category for results. I would like something already built so I can just customize it to our needs. I'm sure it will need to have a database setup for it to work which I am fine with doing. I can modify scripts and files but I have no idea where to start with this from scratch.

We also use the same data for our "Layar" app for the iphone and driod phones. Has anyone messed with layar scripting and databases? We are using hoopala now which makes data entry simple but we cannot modify their database to add category options. It would be nice to find an alternative to hoopala so we could use one database for both the layar app and the zipcode/category search on our site.

View 2 Replies View Related

JQuery :: Class Toggle Navigation - Implement A Minimal Navigation Bar

Nov 2, 2009

I'm trying to implement a minimal navigation bar using jQuery's toggleClass() function but can't seem to get it working.

It's the .img_selector div at the bottom of the page:[url]

I want to toggle the 'active' class for each <a> when it's selected, to indicate which image is showing, so after calling jQuery, in the <head> I've got:

Then the links, which also include the showPic function:

View 4 Replies View Related

Highlight Active Page On Navigation System When Navigation Is Being Included With SSI?

Apr 18, 2010

I am not terribly familiar with Javascript but i am looking forward to learning, and currently the problem I am facing is this:I have an a file being included to an .shtml document, that serves as my navigation, the code is like this:

<ul id="MenuBar1" class="MenuBarHorizontal">
<li><a class="MenuBarItemSubmenu" href="#">Home</a>
<ul>

[code]....

View 12 Replies View Related

JQuery :: Selecting Active Drop-down Option By Category?

Jan 4, 2012

I'm trying to set an option of a drop-down as active, regarding the category. I added the category name for this to the body class="category-XXXX-XXXX". What I need is something like an array to say:

if == category-AAAA-AAAA then option value=1 is selected
if == category-BBBB-BBBB then option value=2 is selected
if == category-CCCC-CCCC then option value=3 is selected

and so on. Unfortunately, I'm getting totally confused where to actually start and how to do that. I know, it is for sure out a line to ask for a finished script, but I'm sure someone can give me a hint, on how to do that.

View 4 Replies View Related

JQuery :: Create An Own Horizontal Navigation And So The Navigation Is A Nested?

Feb 6, 2011

I want to create an own horizontal navigation and so the navigation is a nested list like

<ul id="mymenu">
<li>entry1
<ul class="abc">

[code]....

View 3 Replies View Related

JQuery :: Paid Request: Subcategories Sliding Down Out Of Main Category?

Jul 27, 2010

I was hoping if someone could do this for me, basically I'd like to have a parentcategory. For example this one:''Remixes''

And when you click on it a couple subcategories slide down from under it. Like this

[Code]...

View 3 Replies View Related

JQuery :: Navigation And Sub Navigation Plugin?

Aug 8, 2009

<div>
</div><div>I did some navigation menu and sub menu using jquery ,</div><div>
</div><div>like ;</div><div>
</div><div>Menu1 </div><div> Sub menu1(some.php)</div><div> Sub menu2(some1.php)</div><div>

[Code]..

View 1 Replies View Related

Number / Category Association - Automatically Default Correctly When Put In Just The Number

Jun 16, 2011

When updating our agency's webpage daily, [URL] I am looking for a shortcut to save time.. When I update air quality numbers. I have to put the conditions. Ex.. 50 = good 100= moderate etc etc. As you see here(bold and underlined)

[Code]...

Well instead of having to type good or moderate every-time to correlate with the numbers, I want to find a way the category can automatically default correctly when I put in just the number. Ex, if I put in the number 100, it automatically knows to issue/ put Moderate with out me having to type it. I semi wrote a code .. Yet can't seem to know how to execute. Seeing if Maybe I can get some assistance.

[Code]...

View 4 Replies View Related

JQuery :: Find Reverse - Possible Find A Node Backwards Instead Of Forwards

May 27, 2009

<div>

Is it possible find a node backwards instead of forwards.

I would like to do (remember find_reverse does not exist)

View 7 Replies View Related

Keyboard Navigation Dropdown Menu - Add Support For Keyboard Navigation?

Jan 19, 2009

Ive been working on a site with a dropdown menu. its styled with css and animated with java i would like to add support for keyboard navigation.

var DDSPEED = 5;
var DDTIMER = 5;
main function to handle the mouse events [code].....

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved