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!
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.
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.
I've seen examples of how to turn xml into html, but how can I make the html output clickable so as to be able to access the corresponding original xml element (to read its attribute values)?
The form allows users to enter there details, and when they click on the signup button the following is suppose to happen
1. Thank you note for signing up is displayed, including details they just entered 2. The details entered are stored in an array 3. When you want to view all signups you can click on a signup button and all details are shown 4. The form resets and clears all input fields
I have a form that allows input and functions that validate input, store input, and shows the input and html for the design layout. [code] The two buttons are called signup and members [code]When i run it i can enter all the details and click on signup all the details are still there and then i click on members and it shows all the details i have just entered along side the string signup but it also displays the words 'undefined', so I think there are problems with the array.
Normal way to access data such as arraydata.INPUTID.field1 is no problem.My problem arises when trying to access data when iterating over input fields in a form. THISID is of course the id of the actual input which corresponds to the INPUTID of the data. Can't find a solution, what should stand instead of THISID in the iteration?
I have a little problem (maybe I'm just to tired to get it -.-). I'm trying to access elements which are descendants of another element. I do it by using containers = $('.likeReceiver .powermail_radio_inner'); When counting the elements with .length it says, there are three elements. So far everything is working.However, each time I try to access the elements all I get is a message which says "Undefined".
Is it possible to target certain <li> in an unordered list by index with jQuery? I thought maybe I could use .index but was not able to get the syntax right. I thought maybe something like this would work but is has not:
Am passing an array object back from ASP.NET but cannot work out how to access the child objects and get the value. Link is an image of the asp return object and what I am able view in javascript by console log of the data. Example image - [URL] been trying stuff like data.d.MessageText and a few others.
I'm attempting to design my first 'just-watch-it' canvas show, which fills in randomly each time you click start. Doing pretty well, but this is where I'm stumped:
I have an array of 10,000 coordinate pairs = absolute positions on my canvas. I have this monster array on its own 'page.js' and used a <link src="template.js .. to link it in the head of my 'canvas.html'
How do I instruct my script to make a working copy of it? I don't want to manipulate the template array, but my script needs to make a clone of it ...as what? a variable? an object? I don't know what functions to use. This clone will be manipulated and have indices removed one by one as areas are filled in on the canvas.
I'm trying to generate random numbers 0-8 to use to access array indices.[code]Every once in a while, I'm getting a -1 in my console log. I read on a site that this line:[code]will generate a number between 0 and 10 (so 1-9).How is -1 being generated?
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
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
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.
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:
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:
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.
<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>