Solved

How can I make links usable with HREF and JS code?

Posted on 2015-02-02
5
157 Views
Last Modified: 2016-02-25
Hi guys. I'm making a site out of a template I liked a lot. It mainly uses Bootstrap and some js (which I have no clue on).

I've got the navigation bar filling up beautifully from the DB. Some menu items have children (dropdown menus) and some do not. My problem is that the main menu items (the navigation bar) is made in the template to expect children so when I click on a link inside a children, it takes me to the expected page but when I click on a top-level menu item it does nothing.

Here's the top part of my navigation bar. As you can see there is a HOME button which works if I take out the class attribute out from the link and there is a BROWSE button which shows up as a link and on mouse over it displays a beautiful sub-menu. The links inside the sub-menu work... but the BROWSE main link doesn't take me anywhere:

<li class="dropdown">
	<a href="/" class="dropdown-toggle js-activated">HOME</a> <!-- I can make these work taking out the CLASS -->
</li><!-- /.dropdown -->

<li class="dropdown yamm-fullwidth">
	<a href="browse" class="dropdown-toggle js-activated">BROWSE</a> <!-- These are the ones giving me the hardest time -->
		<ul class="dropdown-menu yamm-dropdown-menu">
			<li>

			<!-- FROM HERE ON ALL WORKS / NO JS ON LINKS AS THEY ARE NOT DROPDOWNS -->

				<div class="yamm-content row">
					<div class="col-sm-4 inner">
						<h4>SOME SUB-MENU TITLE</h4>
						<figure>
							<div class="icon-overlay icn-link">
								<a href="browse/some"><img src="assets/images/static/img54ceb03e707907.63556505.png" alt=""></a>
							</div>
							<figcaption>
								<p>Some text goes here blah blah blah</p>
								<a href="browse/some" class="btn">Some link here</a>
							</figcaption>
						</figure>
					</div><!-- /.col -->
					<div class="col-sm-4 inner">
......................................

Open in new window


Any ideas? Thanks in advance!
0
Comment
Question by:Cesar Aracena
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 31

Expert Comment

by:Marco Gasi
ID: 40585587
To make a link usable you only need to give it a target:
<a href="browse/somepage.html"><img src="assets/images/static/img54ceb03e707907.63556505.png" alt=""></a>

Open in new window

where 'some' is upposed to be a directory and 'somepage.html' the name of the page you want the link bring the user to.
0
 
LVL 6

Author Comment

by:Cesar Aracena
ID: 40586086
Thanks Marco. Tried that among few other things and nothing happened. If I take out the "class" inside the "a" tags, the links work even if they point to a folder directly.
0
 
LVL 31

Accepted Solution

by:
Marco Gasi earned 500 total points
ID: 40586094
Evidently you have some javascript which use that class and prevents that anchor to bring somewhere...
But this makes ense: if a menu item has a submenu, it is intended as a 'door' to access to the submenu and usualy it doesn't have a working link itself. But if you want it to work as a link, you have to go through the javascript code attached to the template to find where that class is used and how. Or you have to post the code here :-)
0
 
LVL 6

Author Closing Comment

by:Cesar Aracena
ID: 40586100
Hmm... I've been thinking about that and it does makes sense. It's a responsive layout so that wouldn't work properly when used in a touch screen device. I guess I'll have to put every option (i this case I'm talking about a "browse all" link) inside the sub-menu.

Thanks for poiting that out ;)
0
 
LVL 31

Expert Comment

by:Marco Gasi
ID: 40586105
Usually, in touch devices the non-existent hover event is replaced by the tap. I'm using bootstrap  in this period and it does all the work to manage this kind of things. But  I agree, even for space and layout reasons: you can add to the submenu an item 'Brwose all' and you've done :-)
Thanks for points and good luck with your project.
0

Featured Post

The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question