FAQ Database Discussion Community


jQuery active menu link to index page is always active

jquery,menu,nav,active
I have a menu that uses the following jQuery to add the class active to highlight the current page. <script> jQuery(document).ready(function($) { $(function() { setNavigation(); }); function setNavigation() { var path = window.location.pathname; path = path.replace(/\/$/, ""); path = decodeURIComponent(path); $(".nav a").each(function() { var href = $(this).attr('href'); if (path.substring(0, href.length)...

How to keep active state on anchor links?

hyperlink,navigation,anchor,active
Preview: http://cssdeck.com/labs/w7bzvb5r Is it possible to keep the navigation link active once clicked and inactive when not selected? I would like it to change color based on which link is selected. For example, on mouse-over it changes from black to blue. How can it stay blue when it is active...

showing object attributes from active record relations

ruby-on-rails,object,record,active
I try to display ingredient.name after the line quantitiy.amount but don't know how to retrieve the name from object Ingredient.where(ingredient_id: quantity.ingredient_id) which returns #<Ingredient::ActiveRecord_Relation:0x8e30590> Code def show @recipe = Recipe.find(params[:id]) @quantities = @recipe.quantities @ingredients = @recipe.ingredients end - @quantities.each do |quantity| %ul %li = quantity.amount = Ingredient.where(ingredient_id: quantity.ingredient_id) class Quantity...

How to find the current nav Li “active” in bootstrap nav

twitter-bootstrap,class,get,nav,active
I need to get the current nav clicked in my bootstrap menu, I know it has an "active" class added to the LI tag, but after looking a lot online and on the bootstrap site, Bootstrap does not seem to offer any javascript value containing the current nav... anybody has...

How to change the value of an active text input using Javascript?

javascript,html,forms,onchange,active
I am trying to make a form with a date input. However, this input is in date format, and I would like to change the value while the control is still active. Here is the full code : // Javascript code function add_value() { var dataoriginale = document.getElementById("fin_mater").value; if(document.getElementById("fin_mater").value.length =...

Create a border around image when active/clicked

css,image,border,active
I want to let my website visitors select from 3 different images and what I want now is a border around the image when they selected, so basically when it's active. I hope it's understandable what I am looking for. Can someone help me perhaps with that? I've tried to...

Underline active link slideToggle (jQuery)

jquery,html,slidetoggle,active,underline
I made a text page where information pops up when the user clicks on a link using slideToggle(). When you click on the next link, the previous text passage automatically closes (also using slideToggle). jQuery(document).ready(function() { jQuery('.textbox a').next('.textbox p').hide(); jQuery('.textbox a').click(function() { $('.active').not(this).toggleClass('active').next('.textbox p').slideToggle(); $(this).toggleClass('active').next().slideToggle(); }); }); .textbox { width:...

how to get a class active when hovering

javascript,php,html,class,active
I already know how to get a class active when clicking on it, but how do I get the class active when I hover over a specific area? Here the code that gets an active class when clicking on in: <li <?=echoActive("contact")?>><a href="contact.php">Contact</a></li> <?php function echoActive($requestUri) { $current_file_name = basename($_SERVER['REQUEST_URI'],...

change subnav active link styling in squarespace

html,css,hyperlink,nav,active
A not-super-advanced coder here.I'm seeking to "simply" adjust the styling of an active link in a sub-navigation on a site. Example page: http://printergatherer.com/shop Referencing the minty green sub-nav that has "ALL ... PRINTS" in it. Right now, I have styling that effects the active link in ALL navigations on the...

VBA: access sheet from userForm

excel,vba,selection,cell,active
I am trying to access my workbook and sheets while I am in a subroutine of my UserForm. My macro starts when the focus in the worksheet is changed: Sub Worksheet_SelectionChange(ByVal Target As Range) '... End Sub In my UserForm, I now wanted to define what happens when the red...

I want to display my text after my thumbnail slider div

javascript,jquery,css,slider,active
I want to display my text after my thumbnail slider div something like this, my active slider class: "itm0 selected" my thumbnail id: "thumbs" i want to display text below my #thumbs div automatically when it is active i tried this CSS, but not worked, .itm0 .selected{ #thumbs::after{ content:"first active...

CSS, HTML On Active Parent/Children

html,css,active
I am trying to set my panel/block to a different color when it has been clicked e.g. active. My HTML is: <div class="container"> <div class="content nobg"> <div class="sideEffectBox text-center medium-6 columns"> <div class="panel hlib"> <img src="http://upload.wikimedia.org/wikipedia/commons/2/24/Icon_Transparent_Loupe_256x256.png"/> <span class="linkText">Record Side Effects</span> </div> </div> </div> </div> My CSS is: .container .content .panel.hlib...

Hover over div changes another div heading

jquery,css,mouseover,active,jquery-hover
I will try to explain this the best I can. I have 5 boxes and want 1 box to have a different heading color. When I hover over the other 4 boxes I want the active box heading to change, resulting in the new heading to be a different color....

Bold an active link in meteor

css,hyperlink,meteor,iron-router,active
I have this code in my navigation bar in Meteor and I'm trying to bold the link when it's active. I've tried using css and a:active {} but that doesn't seem to work. <div class="navSecondary"> <div class="menu" align="center"> <ul class="menu-items"> <li class="active"> <a href="{{pathFor 'home'}}"> HOME </a></li> </ul> </div> </div>...

Using stripos($_SERVER['REQUEST_URI'] for an active state on a list of URL

php,active,stripos
I have this to add an active state on a navigation <li <?php if (stripos($_SERVER['REQUEST_URI'],'/page') !== false) {echo 'class="active"';} ?>><a href="/page">Page</a></li> But I need to add a few pages for the active state to trigger. Something like: <li <?php if (stripos($_SERVER['REQUEST_URI'],'/page', '/another', '/somethingelse') !== false) {echo 'class="active"';} ?>><a href="/page">Page</a></li> ...