On button click, effect multiple elements on page. - button

I'm quite lost here so any help appreciated!
I'm looking for when a button (3 buttons in total) is clicked that it affects multiple elements: 1. it highlights 3 boxes. 2. It shows an area of text.
I have learned multiple id's dont work, think CSS could work with jquery (not overly familiar with jquery.
// Code for the 3 buttons: //
<div class="row">
<div class="col-sm-2 col-xs-4 col-sm-offset-3 center">
<p><?php the_field('button_1'); ?></p>
</div>
<div class="col-sm-2 col-xs-4 center">
<p><?php the_field('button_2'); ?></p>
</div>
<div class="col-sm-2 col-xs-4 center">
<p><?php the_field('button_3'); ?></p>
</div>
</div>
// Code for box areas (on click some will highlight): //
<div class="panel-heading">
<h2><?php the_field('decision_moments_section_title'); ?></h2>
<ul class="nav nav-tabs-v2">
<li class="active col-sm-1-8 col-xs-3 find-mnt">
<a id="snav-content1" data-toggle="tab" class="mnt-hover">
<img class="moment-logo" src="/wp-content/uploads/2018/01/Find.png" alt="Find">
<h4>Find</h4>
</a>
</li>
<li class="col-sm-1-8 col-xs-3 join-mnt">
<a id="snav-content2" data-toggle="tab" class="mnt-hover">
<img class="moment-logo" src="/wp-content/uploads/2018/01/Join.png" alt="Join">
<h4>Join</h4>
</a>
</li>
<li class="col-sm-1-8 col-xs-3 consume-mnt">
<a id="snav-content3" data-toggle="tab" class="mnt-hover">
<img class="moment-logo" src="/wp-content/uploads/2018/01/Consume.png" alt="Consume">
<h4>Consume</h4>
</a>
</li>
<li class="col-sm-1-8 col-xs-3 upgrade-mnt">
<a id="snav-content4" data-toggle="tab" class="mnt-hover">
<img class="moment-logo" src="/wp-content/uploads/2018/01/Upgrade.png" alt="Upgrade">
<h4>Upgrade</h4>
</a>
</li>
<li class="col-sm-1-8 col-xs-3 downgrade-mnt" class="mnt-hover">
<a id="snav-content5 snav-content3" data-toggle="tab">
<img class="moment-logo" src="/wp-content/uploads/2018/01/Downgrade.png" alt="Downgrade">
<h4>Downgrade</h4>
</a>
</li>
<li class="col-sm-1-8 col-xs-3 bill-mnt">
<a id="snav-content6" data-toggle="tab" class="mnt-hover">
<img class="moment-logo" src="/wp-content/uploads/2018/01/Bill.png" alt="Bill">
<h4>Bill</h4>
</a>
</li>
<li class="col-sm-1-8 col-xs-3 leave-mnt">
<a id="snav-content7" data-toggle="tab" class="mnt-hover">
<img class="moment-logo" src="/wp-content/uploads/2018/01/Leave.png" alt="Winback">
<h4>Leave</h4>
</a>
</li>
<li class="col-sm-1-8 col-xs-3 winback-mnt">
<a id="snav-content8" data-toggle="tab" class="mnt-hover">
<img class="moment-logo" src="/wp-content/uploads/2018/01/Winback.png" alt="Winback">
<h4>Winback</h4>
</a>
</li>
</ul>
</div>
// Code for text area that will show on click: //
<div class="tab-content">
<div class="tab-pane fade in active" id="snav-content10">
<div class="row">
<div class="col-sm-12">
<?php the_field('section_1'); ?>
</div>
</div>
</div>
<div class="tab-pane fade" id="snav-content11">
<div class="row">
<div class="col-sm-12">
<?php the_field('section_2'); ?>
</div>
</div>
</div>
<div class="tab-pane fade" id="snav-content12">
<div class="row">
<div class="col-sm-12">
<?php the_field('section_3'); ?>
</div>
</div>
</div>
</div>
this code is taken from elsewhere on the site where the boxes were the areas that were clicked and only affected the text area.
sfsaf
sdf

the css with jquery approach would work fine. if you want to select multiple elements you can use a class selector. here is an example clicking the button highlights three boxes and hides / show a text area.
here is the fiddle
https://jsfiddle.net/2e73h9jp/
// find elements
var banner = $(".banner-message")
var button = $("button")
// handle click and add class
button.on("click", function(){
banner.toggleClass("alt")
$('textarea').toggleClass("hide");
})

Related

Mobile responsive top menu

I m using Clarity Design System with angular and the top menu is not mobile response
<header class="header-2">
<div class="branding">
<a class="nav-link">
<clr-icon shape="home" size="24"></clr-icon>
<span class="title">title</span>
</a>
</div>
<div class="header-nav">
<a class="nav-link nav-text" routerLink="/home">Home</a>
<a class="active nav-link nav-text"
routerLink="/login">Login</a>
</div>
</header>
I m expecting the top menu to turn into few lines (button) when the width is reduce
Or should I use different tags ?
To use responsive navigation, see the documentation on it at https://v2.clarity.design/navigation. You need to use the clr-main-container and clr-header elements to enable this behavior.
Given your markup, it should be something like the following.
<clr-main-container>
<clr-header class="header-2">
<div class="branding">
<a class="nav-link">
<clr-icon shape="home" size="24"></clr-icon>
<span class="title">title</span>
</a>
</div>
<div class="header-nav" [clr-nav-level]="1">
<a class="nav-link nav-text" routerLink="/home">Home</a>
<a class="active nav-link nav-text" routerLink="/login">Login</a>
</div>
</clr-header>
<div class="content-container">
<main class="content-area">
... the main body content goes here, probably a router-outlet
</main>
<nav class="sidenav" [clr-nav-level]="2">
... if you want a sidenav that is, or omit this
</nav>
</div>
</clr-main-container>
Yes it is working perfect now, it solved the behavior
So now is:
<clr-main-container>
<clr-header class="header-2">
<div class="branding">
<a class="nav-link">
<clr-icon shape="home" size="24"></clr-icon>
<span class="title">{{title}}</span>
</a>
</div>
<div class="header-nav" [clr-nav-level]="1">
<div class="header-nav">
<a class="nav-link nav-text" routerLink="/home">Home</a>
<a class="active nav-link nav-text" routerLink="/login">Login</a>
</div>
</div>
</clr-header>
Thank you very much

A Single Column over Multiple Rows

Is it possible to achieve this?
By slightly modifying this codes?
<div class="row">
<div class="col-md-3"></div>
<div class="col-md-6"></div>
<div class="col-md-3"></div>
</div>
EDITED
I can achieve this using below. I'm wondering if there's any other simple way.
<div class="row">
<div class="col-md-3"></div>
<div class="col-md-9">
<div class="row">
<div class="col-md-8"></div>
<div class="col-md-4"></div>
</div>
<div class="row">
<div class="col-md-8"></div>
<div class="col-md-4"></div>
</div>
</div>
</div>
tarako
You may try it by
just add a single div in start and add its height plus hide the lower div
<div class="row">
<div style="height:10px(according to you)" class="col-md-3"></div>
<div class="col-md-6"></div>
<div class="col-md-3"></div>
</div>
Hi you can try with this code
<div class="container-fluid">
<div class="row">
<nav class="col-sm-3 col-md-2 d-none d-sm-block bg-light sidebar">
<ul class="nav nav-pills flex-column">
<li class="nav-item">
<a class="nav-link active" href="#">Overview <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Reports</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Analytics</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Export</a>
</li>
</ul>
<ul class="nav nav-pills flex-column">
<li class="nav-item">
<a class="nav-link" href="#">Nav item</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Nav item again</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">One more nav</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Another nav item</a>
</li>
</ul>
<ul class="nav nav-pills flex-column">
<li class="nav-item">
<a class="nav-link" href="#">Nav item again</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">One more nav</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Another nav item</a>
</li>
</ul>
</nav>
<main class="col-sm-9 ml-sm-auto col-md-10 pt-3" role="main">
<h1>Dashboard</h1>
<section class="row text-center placeholders">
<div class="col-6 col-sm-3 placeholder">
<img src="data:image/gif;base64,R0lGODlhAQABAIABAAJ12AAAACwAAAAAAQABAAACAkQBADs=" width="200" height="200" class="img-fluid rounded-circle" alt="Generic placeholder thumbnail">
<h4>Label</h4>
<div class="text-muted">Something else</div>
</div>
<div class="col-6 col-sm-3 placeholder">
<img src="data:image/gif;base64,R0lGODlhAQABAIABAADcgwAAACwAAAAAAQABAAACAkQBADs=" width="200" height="200" class="img-fluid rounded-circle" alt="Generic placeholder thumbnail">
<h4>Label</h4>
<span class="text-muted">Something else</span>
</div>
<div class="col-6 col-sm-3 placeholder">
<img src="data:image/gif;base64,R0lGODlhAQABAIABAAJ12AAAACwAAAAAAQABAAACAkQBADs=" width="200" height="200" class="img-fluid rounded-circle" alt="Generic placeholder thumbnail">
<h4>Label</h4>
<span class="text-muted">Something else</span>
</div>
<div class="col-6 col-sm-3 placeholder">
<img src="data:image/gif;base64,R0lGODlhAQABAIABAADcgwAAACwAAAAAAQABAAACAkQBADs=" width="200" height="200" class="img-fluid rounded-circle" alt="Generic placeholder thumbnail">
<h4>Label</h4>
<span class="text-muted">Something else</span>
</div>
</section>
</div>
</div>

sonata_type_collection show entities in different tabs

I'm trying to organize the way Sonata Admin shows sonata_type_collection.
It looks like this now:
In the source html code I see that all of that is meant to be tabs
<div class="sonata-ba-tabs">
<div>
<div class="nav-tabs-custom">
<ul class="nav nav-tabs">
<li class="active">
<a href="#s5860de8a43681_1_1" data-toggle="tab">
<i class="icon-exclamation-sign has-errors hide"></i> -
</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="s5860de8a43681_1_1">
<fieldset>
<!--some field here-->
</fieldset>
</div>
</div>
</div>
</div>
<div>
<div class="nav-tabs-custom">
<ul class="nav nav-tabs">
<li class="active">
<a href="#s5860de8a43681_2_1" data-toggle="tab">
<i class="icon-exclamation-sign has-errors hide"></i> -
</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="s5860de8a43681_2_1">
<fieldset>
<!--some field here-->
</fieldset>
</div>
</div>
</div>
</div>
</div>
(I omitted some code to make it shorter)
We can definitely see that it is meant to be some kind of jquery tabs, but I can't really find any information how to make that work like a tabs. Is there anyway to configure the form to implement that?

Navbar drop downs are not working in bootstrap

I created a drop down menu fro my navbar, but it is not working when I hover on it.
My Template,
<header id="header" class="sticky-header" data-sticky-class="not-dark" >
<div id="header-wrap">
<div class="container clearfix">
<div class="divcenter" style="max-width:990px;">
<div id="primary-menu-trigger"><i class="icon-reorder"></i></div>
<!-- Logo
============================================= -->
<div id="logo" style="margin-top: 5px;">
<img src="assets/images/SW-Logo-Final.png" alt="Canvas Logo">
</div>
<span class="inputgroupcss col-sm-5" style="padding-top:12px;">
<input type="email" (keyup)="submit(button1.value)" #button1 class="form-control required email" placeholder="Search by Name or Email"
style="height:38px;">
<div class="col-sm-12 nopadding ">
<ul class="searchlist">
<li *ngFor="let detail of details">
<img [src]='detail.image' alt="profile_image" style="width: 35px;
height: 35px;">
<a (click)="redirect()" [routerLink]="['/demo/user',detail.profilename]">{{detail.profilename}}</a>
</li>
</ul>
</div>
</span>
<!-- #logo end -->
<!-- Primary Navigation
============================================= -->
<!-- <nav id="primary-menu" class="pull-left" style="margin-top:11px">
<form style="width:300px" id="widget-subscribe-form2" action="include/subscribe.php" role="form" method="post" class="nobottommargin">
<div class="input-group input-group-lg divcenter" style="max-width:600px;">
<input type="email" name="widget-subscribe-form-email" class="form-control required email" placeholder="Search by Name or Email" style="height:38px;">
<span class="input-group-addon" style="height: 38px;padding: 6px 16px;"><i class="icon-line-search"></i></span>
</div>
</form> <div *ngFor="let id of ids" class = "nopadding col-sm-12">
<button class="badge notification" (click) = 'getRequests()'>
<span class="glyphicon glyphicon-bell"></span>
</button>
<span class="noti"> {{id.sent_id}}</span>
</div>
</nav> -->
<nav id="primary-menu" class="dark">
<ul>
<li class="onhovercolor">
<a href="#">
<div>srilatha mattepu</div>
</a>
</li>
<li id="top-cart" class="onhovercolor notopmargin noleftpadding" *ngFor="let id of ids"><i class="icon-email3" style="font-size:18px;color: #d35b29;"></i><span>{{id.sent_id}}</span>
<div class="top-cart-content">
<div class="top-cart-title">
<h6 class="nobottommargin text-center">You have {{id.sent_id}} Requests pending</h6>
</div>
<div class="col-xs-12 dropdownpanel">
<h6 class="nobottommargin">Friend Requests</h6>
</div>
<div class="col-xs-12 dropdownpanel">
<div class="col-xs-3 nopadding">
<img src="assets/images/gallery3.png" style="height:45px;width:50px">
</div>
<div class="col-xs-6 nopadding">
<h5 class="nobottommargin pendingnamescss">srilatha mattepu</h5>
</div>
<div class="col-xs-3 nopadding text-right">
pending
</div>
</div>
<div class="col-xs-12 dropdownpanel">
<div class="col-xs-3 nopadding">
<img src="assets/images/gallery3.png" style="height:45px;width:50px">
</div>
<div class="col-xs-6 nopadding">
<h5 class="nobottommargin requestsnamecss">srilatha mattepu</h5>
</div>
<div class="col-xs-3 nopadding text-right">
pending
</div>
</div>
</div>
</li>
<li class="onhovercolor norightpadding">
<div class="downarrowcss"><i class="icon-caret-down" style="font-size:25px !important"></i></div>
<ul class="menu-pos-invert">
<li>
<a href="/demo/profile">
<div><i class="icon-user"></i> My Profile</div>
</a>
</li>
<li>
<a href="/demo/settings">
<div><i class="icon-settings"></i> Settings</div>
</a>
</li>
<li>
<a href="/demo/password">
<div><i class="icon-settings"></i> Change Password</div>
</a>
</li>
<li>
<a href="#">
<div><i class="icon-off"></i> Logout</div>
</a>
</li>
</ul>
</li>
<li class="onhovercolor hidden-sm hidden-md visible-xs">
<a href="#">
<div>srilatha mattepu</div>
</a>
<ul>
<li>PROFILE</li>
<li>SOCIAL ADDRESSES</li>
<li class="list-borbtom">CUSTOM INFO</li>
<li>MY SOCIETY<span>(ALL)</span></li>
<ul class="left-sub-list">
<li>PERSONAL</li>
<li>PROFESSIONAL</li>
</ul>
<li>REQUESTS</li>
<li>MESSAGES</li>
<li class="list-borbtom">SOCIETY UPDATES</li>
<li class="list-borbtom">SEARCH</li>
<li class="list-borbtom">PASSWORD</li>
<li>SETTINGS</li>
<li>LOGOUT</li>
<li>Qr Code</li>
</ul>
</li>
</ul>
</nav>
<!-- #primary-menu end -->
</div>
</div>
</div>
</header>
I created a drop down menu fro my navbar, but it is not working when I hover on it.
First thing is that you have to use pure Bootstrap Navbar code.
and then simply add below Custom jQuery, and see magic your Drop-down will be open on hover of your parent menu link hover.
$('ul.nav li.dropdown').hover(function() {
$(this).find('.dropdown-menu').stop(true, true).delay(200).fadeIn(500);
}, function() {
$(this).find('.dropdown-menu').stop(true, true).delay(200).fadeOut(500);
});
Please check attached fiddle.

Using bootstrap css to display html components

I trying to put few html elements to show them properly. But could not get how to place them inline.
CODEPEN : CODEPEN DEMO
<div class="jumbotron">
<ul class="media-list">
<li class="media">
<a class="pull-left" href="#">
<img class="media-object" src="http://www.menucool.com/slider/prod/image-slider-4.jpg" height="35">
</a>
<div class="media-body">
<h6 class="media-heading"> This is small description of image </h6>
</div>
</li>
</ul>
<h6>Wat more? ....... </h6>
<ul class="nav nav-pills nav-stacked">
<li class="active">
<a href="#">
<span class="badge pull-right">42</span>
Only value
</a>
</li>
<span> Above code should look like this </span>
<img src="http://snag.gy/cPTCL.jpg">

Resources