Comments (15)
None of the solutions above worked for me. I followed that bootstrap link above, which gave me this
$('.dropdown-toggle').click(function() { var location = $(this).attr('href'); window.location.href = location; return false; });
and it works perfectly!
from wordpress-bootstrap.
Same Issue here :/
If you have found a working solution it would be kind to share it with me!
from wordpress-bootstrap.
Hi @jansolo76 @bassscape
CSS 2+:
nav > ul > li > ul {display:none}
nav > ul > li:hover ul {display:block}
nav > ul > li > ul > li > ul{display:none}
nav > ul > li > ul > li:hover ul {display:block}
from wordpress-bootstrap.
Hi @wuliupo,
thanks for your help, but that didn't solve the problem.
I actually changed line 65 in library/js/bootstrap-dropdown.js from false to true.
I don't know why it now does like it should, but it does...
from wordpress-bootstrap.
Hi @wuliupo
Thanks for your input. I believe your css enables the dropdown menu items to appear on hover - please correct me if I am wrong. The first piece of css I included has already achieved this.
I'm still looking for a way the make toplevels links with dropdown menus clickable and link to it's page when its dropdown menu is displayed on hover. I don't know if I'm getting my css selectors wrong for my menu markup.Currently the html for the menu is this:
<ul id="menu-primary-navigation" class="nav pull-left">
<li id="menu-item-6" class="menu-item menu-item-type-post_type menu-item-object-page current-menu-item page_item page-item-4 current_page_item dropdown menu-item-6 active active"data-dropdown="dropdown">
<a href="http://testing-wp.loc/" class="dropdown-toggle" data-toggle="dropdown">Home <b class="caret"></b> </a>
<ul class="dropdown-menu">
<li id="menu-item-63" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-63"><a href="http://testing-wp.loc/child-page/">Child Page</a></li>
</ul>
</li>
</ul>
While I don't have the toplevel links with dropdown menus clickable and linking to pages I have improved the UI by using this css to hide the default hand pointer cursor for used for links.
ul.nav li.dropdown:hover a.dropdown-toggle { text-decoration:none; cursor:default }
from wordpress-bootstrap.
Hi @bassscape
I already posted the solution! ;)
from wordpress-bootstrap.
Well, i actually meant that i got the "responsive" dropdown working.
The parent menu-links simply didn't react on clicks. Now they do....i have not tested what kind of side effects it has on the fixed (scrollable) default navbar whatsoever, since i have disabled it and changed it against a left sidebar....
from wordpress-bootstrap.
@jansolo76
You submitted your answer as i was writing my response out - sorry.
I don't want to edit the 320press WordPress Bootstrap theme files so I'm using a child theme.
I have modified the bootstrap-dropdown.js file and included it as part of my child theme. I have deregistered the bootstrap-dropdown.js from the 320press WordPress Bootstrap theme files and enqueued the modified version from the childt heme.
/*--------------------------------------------------------------------------*/
/* MODIFY THE 320press WordPress BOOTSTRAP NAVBAR */
/* TOPLEVEL LINKS WILL STILL LINK TO PAGES WHEN DROPDOWNS DISPLAY ON HOVER */
/*--------------------------------------------------------------------------*/
if (!is_admin()) add_action( 'wp_print_scripts', 'pp_add_remove_js', 11 );
function pp_add_remove_js( ) {
wp_deregister_script('bootstrap-dropdown');
/* MODIFIED BOOTSTRAP DROPDOWNS JS */
wp_enqueue_script( 'pp_bootstrap_dropdown', get_bloginfo('stylesheet_directory').'/pp_includes/bootstrap_js/bootstrap-dropdown.js', array( 'jquery' ), '', true);
}
Thanks for your advice to edit the file bootstrap-dropdown.js!
from wordpress-bootstrap.
@wuliupo your solution worked fantastically for me. Thank you! :)
from wordpress-bootstrap.
@bassscape 👍 for sharing the solution. Cheers!
from wordpress-bootstrap.
This solution no longer works can anyone else with any update?
from wordpress-bootstrap.
from wordpress-bootstrap.
@touchst works a charm... many thanks.
from wordpress-bootstrap.
how to Clickable (linking) toplevel navbar links with dropdowns in WordPress
from wordpress-bootstrap.
I needed a different solution, in my case I only wanted the parent link to work in case the dropdown was visible, hope this can help someone
`
//Only go to the link when dropdown is already open (if the dropdown is a link)
$('.navbar ul.navbar-nav > .dropdown > a[href]').click(function() {
var dropdown = $(this).next('.dropdown-menu');
// * The dropdown can be non-existent
// * The dropdown can be already open by css
// * (for instance display: block from a custom :hover setting)
// * or a "show" class on the element which also sets a display: block;
if (dropdown.length == 0 || $(dropdown).css('display') !== 'none') {
if (this.href) {
location.href = this.href;
}
}
});`
from wordpress-bootstrap.
Related Issues (20)
- Javascript Live Reload
- Main site down HOT 1
- Cannot access global $wp_query;
- Can't make it work on windows+wamp HOT 2
- Font Awesome not working HOT 8
- Drop down menu isn't working HOT 2
- Nav Item > Child > Child does not open on click HOT 5
- Is development on this theme dead? HOT 22
- Keeping npm and bower up to date HOT 2
- Can use this themes in shared hosting ? (cant npm) HOT 3
- How to Change default boostrap theme to bootswatch cyborg
- Importing Custom fonts in theme
- Wrong call for previous and next posts link in index.php
- Where Are [caption] tags being stripped put
- Limited number of Menus
- I recommend moving to this project
- second level menu not working HOT 2
- Demo Not Working
- collapsed menu
- I'd like to update the versions and documentation HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wordpress-bootstrap.