MVC JavaScript code does not work - javascript

I'm trying to do the mail box. Codes I want to hide my mail I get mail all the details of the show and yet does not work.
Show/Hidden class id='Detay'
Nuget Package = MimeKit
Show part
Clicked javascript I want to hide the data-side was the same.
<span onclick="Goster()" class="sender" data-id="#item.MessageId" title="#item.From">#item.From </span>
It was to hideShow/hidden
<div id="Detay" data-id="#item.MessageId" style="display: none">
hidden button
<div class="messagebar-item-left">
<a onclick="Gizle()" href="#" class="btn-back-message-list">
<i class="ace-icon fa fa-arrow-left bigger-110 middle blue"></i>
<b onclick="Gizle" class="middle bigger-110">Geri</b>
</a>
</div>
javascript code
<script type="text/javascript">
function Gizle() {
var divObject = document.getElementById('Detay');
divObject.style.display = 'none';
}
function Goster() {
var divObject = document.getElementById('Detay');
divObject.style.display = 'block';
}
</script>

each html element must have a unique id,
in your code you are assigning the same id to multiple div elements inside a foreach loop! you have to make it unique by adding a number for example;
<!--Show / Hidden to be part-->
<div id="Detay#(item.MessageId)" style="display: none">
when you will call show/hide you can parse the id like below:
<span onclick="Goster('Detay#(item.MessageId)')" class="sender" title="#item.From">#item.From </span>
and for hiding use this:
<b onclick="Gizle('Detay#(item.MessageId)')" class="bigger-110 middle">Geri</b>
finally you have to modify you javascript to accept the id parameter:
<script type="text/javascript">
function Gizle(id) {
$('#'+id).toggle(false);
}
function Goster(id) {
$('#' + id).toggle(true);
}
</script>
[UPDATE]
Full solution:
<div class="main-content">
<div class="main-content-inner">
<div class="breadcrumbs ace-save-state" id="breadcrumbs">
<ul class="breadcrumb">
<li>
<i class="ace-icon fa fa-home home-icon">#Html.ActionLink("Ana Sayfa", "Index", "Home")</i>
</li>
<li class="active">Mail Kutusu</li>
</ul><!-- /.breadcrumb -->
</div>
<div class="page-content">
<div class="row">
<div class="col-xs-12">
<!-- PAGE CONTENT BEGINS -->
<div class="col-xs-12">
<div class="tabbable">
<ul id="inbox-tabs" class="inbox-tabs nav nav-tabs padding-16 tab-size-bigger tab-space-1">
<li class="active">
<a data-toggle="tab" href="#inbox" data-target="inbox">
<i class="blue ace-icon fa fa-inbox bigger-130"></i>
<span class="bigger-110">Gelen Kutusu</span>
</a>
</li>
<li>
<a data-toggle="tab" href="#sent" data-target="sent">
<i class="orange ace-icon fa fa-location-arrow bigger-130"></i>
<span class="bigger-110">Sent</span>
</a>
</li>
</ul>
<div class="tab-content no-border no-padding">
<div id="inbox" class="tab-pane in active">
<div class="message-container">
<div class="message-navbar clearfix">
<div class="message-bar">
<div class="message-infobar" id="id-message-infobar">
<span class="blue bigger-150">Mesaj Kutusu</span>
</div>
</div>
</div>
<div class="message-list-container">
<div class="message-list">
<!--<div class="message-item message-unread"> okunmamış-->
#foreach (var item in client.OrderByDescending(p => p.Date))
{
<div class="message-item">
<label class="inline">
<span class="lbl"></span>
</label>
<!--Show/Hidden Click-->
<span onclick="Goster('detay#(item.MessageId)')" class="sender" title="#item.From">#item.From </span>
<span class="time">#mvcHelper.saatAyarla(item.Date)</span>
#if (item.Attachments.Any())
{
<span class="attachment">
<i class="ace-icon fa fa-paperclip"></i>
</span>
}
<span class="summary">
<span onclick="Goster('detay#(item.MessageId)')" class="text">
#item.Subject
</span>
</span>
</div>
<!--Show / Hidden to be part-->
<div id="detay#(item.MessageId)" style="display: none">
<div class="message-container">
<div id="id-message-list-navbar" class="message-navbar clearfix hide">
<div>
<div class="messagebar-item-right">
<div class="inline position-relative">
<a href="#" data-toggle="dropdown" class="dropdown-toggle">
Sort
<i class="ace-icon fa fa-caret-down bigger-125"></i>
</a>
<ul class="dropdown-menu dropdown-lighter dropdown-menu-right dropdown-100">
<li>
<a href="#">
<i class="ace-icon fa fa-check green"></i>
Date
</a>
</li>
<li>
<a href="#">
<i class="ace-icon fa fa-check invisible"></i>
From
</a>
</li>
<li>
<a href="#">
<i class="ace-icon fa fa-check invisible"></i>
Subject
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<div id="id-message-item-navbar" class="message-navbar clearfix">
<div class="message-bar">
</div>
<div>
<div class="messagebar-item-left">
<a href="#" class="btn-back-message-list">
<i class="ace-icon fa fa-arrow-left blue bigger-110 middle"></i>
<b onclick="Gizle('detay#(item.MessageId)')" class="bigger-110 middle">Geri</b>
</a>
</div>
<div class="messagebar-item-right">
<i class="ace-icon fa fa-clock-o bigger-110 orange"></i>
<span class="grey">#mvcHelper.saatAyarla(item.Date)</span>
</div>
</div>
</div>
<div id="id-message-new-navbar" class="hide message-navbar clearfix">
<div>
<div class="messagebar-item-left">
<a onclick="Gizle()" href="#" class="btn-back-message-list">
<i class="ace-icon fa fa-arrow-left bigger-110 middle blue"></i>
<b onclick="Gizle" class="middle bigger-110">Geri</b>
</a>
</div>
</div>
</div>
<div class="message-list-container">
<div class="message-list hide" id="message-list"></div>
<div class="message-content" id="id-message-content">
<div class="message-header clearfix">
<div class="pull-left">
<span class="blue bigger-125"> #item.Subject </span>
<div class="space-4"></div>
<i class="ace-icon fa fa-star orange2"></i>
<img class="middle" alt="John's Avatar" src="/Areas/admin/Content/images/avatars/avatar.png" width="32">
#item.From
<i class="ace-icon fa fa-clock-o bigger-110 orange middle"></i>
<span class="time grey">#mvcHelper.saatGoster(item.Date)</span>
</div>
</div>
<div class="hr hr-double"></div>
<div style="position: relative;" class="message-body ace-scroll">
<div style="display: block; height: 150px;" class="scroll-track scroll-visible scroll-active">
<div style="height: 127px; top: 0px;" class="scroll-bar"></div>
</div>
<div style="max-height: 150px;" class="scroll-content">
<p>
#item.GetTextBody(TextFormat.Plain)
</p>
</div>
</div>
<div class="hr hr-double"></div>
#if (item.Attachments.Any())
{
<div class="message-attachment clearfix">
<div class="attachment-title">
<span class="blue bolder bigger-110">Ekler</span>
<span class="grey">#item.Attachments.Count()</span>
<div class="inline position-relative">
<a href="#" data-toggle="dropdown" class="dropdown-toggle">
<i class="ace-icon fa fa-caret-down bigger-125 middle"></i>
</a>
<ul class="dropdown-menu dropdown-lighter">
<li>
Download all as zip
</li>
<li>
Display in slideshow
</li>
</ul>
</div>
</div>
<ul class="attachment-list pull-left list-unstyled">
#foreach (var attachment in item.Attachments)
{
<li>
<a href="#" class="attached-file">
<i class="ace-icon fa fa-file-o bigger-110"></i>
<span class="attached-name">#mvcHelper.getAttachmentName(attachment.ToString())</span>
</a>
<span class="action-buttons">
<a href="#">
<i class="ace-icon fa fa-download bigger-125 blue"></i>
</a>
<a href="#">
<i class="ace-icon fa fa-trash-o bigger-125 red"></i>
</a>
</span>
</li>
}
</ul>
</div>
}
</div>
</div>
</div>
</div>
}
<!--ForEach End-->
</div>
</div>
<div class="message-footer clearfix">
<div class="pull-left"> Total</div>
<div class="pull-right">
<div class="inline middle"> page 1 of 16 </div>
<ul class="pagination middle">
<li class="disabled">
<span>
<i class="ace-icon fa fa-step-backward middle"></i>
</span>
</li>
<li class="disabled">
<span>
<i class="ace-icon fa fa-caret-left bigger-140 middle"></i>
</span>
</li>
<li>
<span>
<input value="1" maxlength="3" type="text">
</span>
</li>
<li>
<a href="#">
<i class="ace-icon fa fa-caret-right bigger-140 middle"></i>
</a>
</li>
<li>
<a href="#">
<i class="ace-icon fa fa-step-forward middle"></i>
</a>
</li>
</ul>
</div>
</div>
<div class="hide message-footer message-footer-style2 clearfix">
<div class="pull-left"> </div>
<div class="pull-right">
<div class="inline middle"> </div>
<ul class="pagination middle">
<li class="disabled">
<span>
<i class="ace-icon fa fa-angle-left bigger-150"></i>
</span>
</li>
<li>
<a href="#">
<i class="ace-icon fa fa-angle-right bigger-150"></i>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div><!-- /.tab-content -->
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
function Gizle(detayId) {
$('#'+detayId).toggle(false);
}
function Goster(detayId) {
$('#'+detayId).toggle(true); }
</script>

Related

Achieve dynamic Prev and Next functionality for pagination using Isotope

I'm using jQuery Isotope for my pagination functionality. Does anyone know if this sort of thing is built into jquery-isotope? I read the documentation but couldn't find anything.
I got the pages working with no issues, but currently, the next and prev are not functioning as intended and are showing all 6 divs.
I'm currently trying to make the prev and next buttons work in the sense that they will flow to the appropriate (opposite) page when clicked, and works dynamically. I have attempted to achieve this functionality in jQuery under // attempt at making prev and next buttons work. jQuery is not my most robust language so I'd prefer a pure JS solution if possible, but I am open to anything.
/**
* selector helper function
*/
const select = (el, all = false) => {
el = el.trim()
if (all) {
return [...document.querySelectorAll(el)]
} else {
return document.querySelector(el)
}
}
/**
* onscroll event listener
*/
const onscroll = (el, listener) => {
el.addEventListener('scroll', listener)
}
// get to top after new page click
let pageTop = select('.page-top')
if (pageTop) {
const togglePagetop = () => {
if (window.scrollY > 100) {
pageTop.classList.add('active')
} else {
pageTop.classList.remove('active')
}
}
window.addEventListener('load', togglePagetop)
onscroll(document, togglePagetop)
}
/**
* Team Isotope and filter
*/
let teamIsotope = document.querySelector('.team-isotope');
if (teamIsotope) {
let teamFilter = teamIsotope.getAttribute('data-team-filter') ? teamIsotope.getAttribute('data-team-filter') : '*';
let teamLayout = teamIsotope.getAttribute('data-team-layout') ? teamIsotope.getAttribute('data-team-layout') : 'masonry';
let teamSort = teamIsotope.getAttribute('data-team-sort') ? teamIsotope.getAttribute('data-team-sort') : 'original-order';
window.addEventListener('load', () => {
let teamIsotope = new Isotope(document.querySelector('.team-container'), {
itemSelector: '.team-member',
layoutMode: teamLayout,
filter: teamFilter,
sortBy: teamSort
});
let menuFilters = document.querySelectorAll('.team-isotope .team-filters li');
menuFilters.forEach(function(el) {
el.addEventListener('click', function() {
document.querySelector('.team-isotope .team-filters .filter-active').classList.remove('filter-active');
this.classList.add('filter-active');
teamIsotope.arrange({
filter: this.getAttribute('data-filter')
});
if (typeof aos_init === 'function') {
aos_init();
}
}, false);
});
});
}
// attempt at making prev and next buttons work
var page = 0;
var $items = $(".team-container > .team-member");
var $grid = $(".team-container");
function filtre() {
var ell = [];
for (i = page * 3; i < (page + 1) * 3; i++) {
ell.push($items[i]);
}
$grid.isotope({
filter: ell
})
return ell;
}
$("#next").on("click", function() {
if (page < 3) {
page += 1;
filtre();
}
})
$("#prev").on("click", function() {
if (page > 0) {
page -= 1;
filtre();
}
})
.pagination-a .pagination .page-item.filter-active .page-link {
background-color: #72bf43;
}
.team-isotope {
display: flex;
flex-direction: column-reverse;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons#1.3.0/font/bootstrap-icons.css">
<div class="container">
<div class="team-isotope" data-team-filter=".filter-first" data-team-layout="masonry" data-team-sort="original-order">
<nav class="pagination-a">
<ul class="pagination justify-content-end team-filters">
<li class="page-item prev" id="prev">
<a class="page-link" href="#" tabindex="-1">
<span class="bi bi-chevron-left"></span>
</a>
</li>
<li data-filter=".filter-first" class="page-item filter-active">
<a class="page-link page-top" href="#">1</a>
</li>
<li data-filter=".filter-second" class="page-item">
<a class="page-link page-top" href="#">2</a>
</li>
<li class="page-item next" id="next">
<a class="page-link" href="#">
<span class="bi bi-chevron-right"></span>
</a>
</li>
</ul>
</nav>
<div class="row team-container">
<div class="col-lg-4 col-md-6 col-sm-12 team-member filter-first">
<div class="card-box-d">
<div class="card-img-d">
<img src="https://dummyimage.com/200/000/fff" alt="" class="img-d img-fluid">
</div>
<div class="card-overlay card-overlay-hover">
<div class="card-header-d">
<div class="card-title-d align-self-center">
<h3 class="title-d my-2 m-0">
<a href="" class="link-two">foo fooman
<i class="bi bi-link-45deg"></i>
</a>
</h3>
</div>
</div>
<div class="card-body-d">
<p class="content-d color-text-a">
This company was founded and constructed by foo fooman.
</p>
<div class="info-agents color-a mt-3">
<p>
<strong class="color-b">Role: </strong> Principal
</p>
<p>
<strong class="color-b">Phone: </strong> +54 356 945-2334
</p>
<p>
<strong class="color-b">Email: </strong> agents#example.com
</p>
</div>
</div>
<div class="card-footer-d">
<div class="socials-footer d-flex justify-content-center">
<ul class="list-inline">
<li class="list-inline-item">
<a href="#" class="color-text-a">
<i class="bi bi-facebook" aria-hidden="true"></i>
</a>
</li>
<li class="list-inline-item">
<a href="#" class="color-text-a">
<i class="bi bi-twitter" aria-hidden="true"></i>
</a>
</li>
<li class="list-inline-item">
<a href="#" class="color-text-a">
<i class="bi bi-instagram" aria-hidden="true"></i>
</a>
</li>
<li class="list-inline-item">
<a href="#" class="color-text-a">
<i class="bi bi-linkedin" aria-hidden="true"></i>
</a>
</li>
<li class="list-inline-item">
<a href="team/nick-lind.html" class="color-text-a">
<i class="bi bi-link-45deg"></i>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 col-sm-12 team-member filter-first">
<div class="card-box-d">
<div class="card-img-d">
<img src="https://dummyimage.com/200/000/fff" alt="" class="img-d img-fluid">
</div>
<div class="card-overlay card-overlay-hover">
<div class="card-header-d">
<div class="card-title-d align-self-center">
<h3 class="title-d">
<a href="maintenance-mode.html" class="link-two">foo fooman
<i class="bi bi-link-45deg"></i>
</a>
</h3>
</div>
</div>
<div class="card-body-d">
<p class="content-d color-text-a">
foo fooman is a Project Manager
</p>
<div class="info-agents color-a">
<p>
<strong class="color-b">Role: </strong> Project Manager
</p>
<p>
<strong class="color-b">Phone: </strong> +54 356 945-2334
</p>
<p>
<strong class="color-b">Email: </strong> foo#foofooman.com
</p>
</div>
</div>
<div class="card-footer-d">
<div class="socials-footer d-flex justify-content-center">
<ul class="list-inline">
<li class="list-inline-item">
<a href="#" class="color-text-a">
<i class="bi bi-facebook" aria-hidden="true"></i>
</a>
</li>
<li class="list-inline-item">
<a href="#" class="color-text-a">
<i class="bi bi-twitter" aria-hidden="true"></i>
</a>
</li>
<li class="list-inline-item">
<a href="#" class="color-text-a">
<i class="bi bi-instagram" aria-hidden="true"></i>
</a>
</li>
<li class="list-inline-item">
<a href="#" class="color-text-a">
<i class="bi bi-linkedin" aria-hidden="true"></i>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 col-sm-12 team-member filter-first">
<div class="card-box-d">
<div class="card-img-d">
<img src="https://dummyimage.com/200/000/fff" alt="" class="img-d img-fluid">
</div>
<div class="card-overlay card-overlay-hover">
<div class="card-header-d">
<div class="card-title-d align-self-center">
<h3 class="title-d">
<a href="maintenance-mode.html" class="link-two">foo fooman
<i class="bi bi-link-45deg"></i>
</a>
</h3>
</div>
</div>
<div class="card-body-d">
<p class="content-d color-text-a">
foo is a Project Manager for
</p>
<div class="info-agents color-a">
<p>
<strong class="color-b">Role: </strong> Project Manager
</p>
<p>
<strong class="color-b">Phone: </strong> +54 356 945-2334
</p>
<p>
<strong class="color-b">Email: </strong> foo#foofooman.com
</p>
</div>
</div>
<div class="card-footer-d">
<div class="socials-footer d-flex justify-content-center">
<ul class="list-inline">
<li class="list-inline-item">
<a href="#" class="color-text-a">
<i class="bi bi-facebook" aria-hidden="true"></i>
</a>
</li>
<li class="list-inline-item">
<a href="#" class="color-text-a">
<i class="bi bi-twitter" aria-hidden="true"></i>
</a>
</li>
<li class="list-inline-item">
<a href="#" class="color-text-a">
<i class="bi bi-instagram" aria-hidden="true"></i>
</a>
</li>
<li class="list-inline-item">
<a href="#" class="color-text-a">
<i class="bi bi-linkedin" aria-hidden="true"></i>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 col-sm-12 team-member filter-second">
<div class="card-box-d">
<div class="card-img-d">
<img src="https://dummyimage.com/200/e1e1e1/000000" alt="" class="img-d img-fluid">
</div>
<div class="card-overlay card-overlay-hover">
<div class="card-header-d">
<div class="card-title-d align-self-center">
<h3 class="title-d my-2 m-0">
<a href="" class="link-two">foo fooman
<i class="bi bi-link-45deg"></i>
</a>
</h3>
</div>
</div>
<div class="card-body-d">
<p class="content-d color-text-a">
This company was founded and constructed by foo fooman.
</p>
<div class="info-agents color-a mt-3">
<p>
<strong class="color-b">Role: </strong> Principal
</p>
<p>
<strong class="color-b">Phone: </strong> +54 356 945-2334
</p>
<p>
<strong class="color-b">Email: </strong> agents#example.com
</p>
</div>
</div>
<div class="card-footer-d">
<div class="socials-footer d-flex justify-content-center">
<ul class="list-inline">
<li class="list-inline-item">
<a href="#" class="color-text-a">
<i class="bi bi-facebook" aria-hidden="true"></i>
</a>
</li>
<li class="list-inline-item">
<a href="#" class="color-text-a">
<i class="bi bi-twitter" aria-hidden="true"></i>
</a>
</li>
<li class="list-inline-item">
<a href="#" class="color-text-a">
<i class="bi bi-instagram" aria-hidden="true"></i>
</a>
</li>
<li class="list-inline-item">
<a href="#" class="color-text-a">
<i class="bi bi-linkedin" aria-hidden="true"></i>
</a>
</li>
<li class="list-inline-item">
<a href="team/nick-lind.html" class="color-text-a">
<i class="bi bi-link-45deg"></i>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 col-sm-12 team-member filter-second">
<div class="card-box-d">
<div class="card-img-d">
<img src="https://dummyimage.com/200/e1e1e1/000000" alt="" class="img-d img-fluid">
</div>
<div class="card-overlay card-overlay-hover">
<div class="card-header-d">
<div class="card-title-d align-self-center">
<h3 class="title-d">
<a href="maintenance-mode.html" class="link-two">foo fooman
<i class="bi bi-link-45deg"></i>
</a>
</h3>
</div>
</div>
<div class="card-body-d">
<p class="content-d color-text-a">
foo fooman is a Project Manager
</p>
<div class="info-agents color-a">
<p>
<strong class="color-b">Role: </strong> Project Manager
</p>
<p>
<strong class="color-b">Phone: </strong> +54 356 945-2334
</p>
<p>
<strong class="color-b">Email: </strong> foo#foofooman.com
</p>
</div>
</div>
<div class="card-footer-d">
<div class="socials-footer d-flex justify-content-center">
<ul class="list-inline">
<li class="list-inline-item">
<a href="#" class="color-text-a">
<i class="bi bi-facebook" aria-hidden="true"></i>
</a>
</li>
<li class="list-inline-item">
<a href="#" class="color-text-a">
<i class="bi bi-twitter" aria-hidden="true"></i>
</a>
</li>
<li class="list-inline-item">
<a href="#" class="color-text-a">
<i class="bi bi-instagram" aria-hidden="true"></i>
</a>
</li>
<li class="list-inline-item">
<a href="#" class="color-text-a">
<i class="bi bi-linkedin" aria-hidden="true"></i>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 col-sm-12 team-member filter-second">
<div class="card-box-d">
<div class="card-img-d">
<img src="https://dummyimage.com/200/e1e1e1/000000" alt="" class="img-d img-fluid">
</div>
<div class="card-overlay card-overlay-hover">
<div class="card-header-d">
<div class="card-title-d align-self-center">
<h3 class="title-d">
<a href="maintenance-mode.html" class="link-two">foo fooman
<i class="bi bi-link-45deg"></i>
</a>
</h3>
</div>
</div>
<div class="card-body-d">
<p class="content-d color-text-a">
foo is a Project Manager for
</p>
<div class="info-agents color-a">
<p>
<strong class="color-b">Role: </strong> Project Manager
</p>
<p>
<strong class="color-b">Phone: </strong> +54 356 945-2334
</p>
<p>
<strong class="color-b">Email: </strong> foo#foofooman.com
</p>
</div>
</div>
<div class="card-footer-d">
<div class="socials-footer d-flex justify-content-center">
<ul class="list-inline">
<li class="list-inline-item">
<a href="#" class="color-text-a">
<i class="bi bi-facebook" aria-hidden="true"></i>
</a>
</li>
<li class="list-inline-item">
<a href="#" class="color-text-a">
<i class="bi bi-twitter" aria-hidden="true"></i>
</a>
</li>
<li class="list-inline-item">
<a href="#" class="color-text-a">
<i class="bi bi-instagram" aria-hidden="true"></i>
</a>
</li>
<li class="list-inline-item">
<a href="#" class="color-text-a">
<i class="bi bi-linkedin" aria-hidden="true"></i>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.isotope/3.0.6/isotope.pkgd.js" integrity="sha512-E/yP5UiPXb6VelX+dFLuUD+1IZw/Kz7tMncFTYbtoNSCdRZPFoGN3jZ2p27VUxHEkhbPiLuZhZpVEXxk9wAHCQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
Note: I'd like to have prev disabled when the page loads, and enabled after next is clicked. & vice versa.

Stop Hover Menu Closing when User Moves Out of Section

I have a side menu that opens when the user hovers over it. In one section when the user clicks on a menu item a popover opens next to it.
But when you move onto the popover to select something from the dropdown menu the hover menu closes and leaves the popover. I tried using stopPropagation(), but the menu still closes.
Any ideas on how to fix this issue?
<li class="active treeview menu-open" id="testExecution">
<!-- sidebar menu item 1: Test Execution -->
<a>
<i class="fa fa-bars"></i> <span>Test Execution</span>
<span class="pull-right-container">
<i class="fa fa-angle-left pull-right"></i>
</span>
</a>
<ul class="treeview-menu">
<!-- sidebar submenu -->
<li class="active treeview menu-open" id="partnersTree" onclick="closePopovers()">
<a>
<i class="fa fa-circle-o"></i> <span>Partners</span>
<span class="pull-right-container">
<i class="fa fa-angle-left pull-right"></i>
</span>
</a>
<ul class="treeview-menu">
<li class="active" id='tab1'><a><i class="fa fa-circle"></i> tab1</a></li>
<li id='tab2'><a><i class="fa fa-circle"></i>tab2</a></li>
<li id='tab3'><a><i class="fa fa-circle"></i> tab3</a></li>
</ul>
</li>
<li class="treeview" id="historySettings">
<a>
<i class="fa fa-circle-o"></i> <span>History Settings</span>
<span class="pull-right-container">
<i class="fa fa-angle-left pull-right"></i>
</span>
</a>
<ul class="treeview-menu">
<li><a id="versionHistory" data-container="body" data-toggle="popover" data-placement="right">
<i class="fa fa-gear"></i> <span>Version History</span>
<span class="pull-right-container">
<i class="fa fa-angle-right pull-right"></i>
</span>
</a>
</li>
<div class='_content' id='versionHistoryPicker' style='width:250px'>
<div class="form-group">
<label>Select Version:</label>
<select class="form-control" id="versionDropdown" style="background-color:#ffffff; color:#777777" >
<option selected="selected" disabled="true"> Please Select Version </option>
</select>
</div>
<button type="submit" class="btn btn-default btn-block" onclick="drawHistoryCharts()">Submit</button>
</div>
<li><a id="dateHistory" data-container="body" data-toggle="popover" data-placement="right">
<i class="fa fa-gear"></i> <span>Date History</span>
<span class="pull-right-container">
<i class="fa fa-angle-right pull-right"></i>
</span>
</a>
</li>
<div class='_content' id='dateHistoryPicker' style='width:250px'>
<div class="form-group">
<label>Date range:</label>
<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-calendar"></i>
</div>
<input type="text" class="form-control pull-right" id="reservation">
</div>
</div>
<button type="submit" class="btn btn-default btn-block" onclick="dateHistoryChart()">Submit</button>
</div>
<li><a onclick="onLoad()">
<i class="fa fa-refresh"></i> <span>RESET PAGE</span>
<span class="pull-right-container">
</span>
</a>
</li>
</ul>
</li>
</ul>
</li>
$("#testExecution").mouseout(
function(e) {
event.stopPropagation();
});

How can I use this condition outside click function?

I write this code:
$('.toggler').click(function() {
$(this).parent().nextAll('ul').toggleClass('closed');
if ($(this).parent().next('ul') != true) {
$(this).prev().removeClass('ion-ios-plus-outline');
$(this).prev().addClass('ion-ios-minus-outline');
}
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<ul>
<!-- First level -->
<li class="branch">
<!-- btn -->
<div class="d-flex justfiy-content-between">
<i class="ion-ios-plus-outline ml-2"></i>
<span class="toggler ml-3">لول اول</span>
<span class="btns d-flex">
<a class="bg-danger" href="">
<i class="ion-trash-b"></i>
</a>
<a class="bg-info mr-2" href="">
<i class="ion-edit"></i>
</a>
</span>
</div>
<!-- Second level -->
<ul class="closed">
<li class="branch">
<!-- btn -->
<div class="d-flex justfiy-content-between">
<i class="ion-ios-plus-outline ml-2"></i>
<span class="toggler ml-3">لول دوم</span>
<span class="btns d-flex">
<a class="bg-danger" href="">
<i class="ion-trash-b"></i>
</a>
<a class="bg-info mr-2" href="">
<i class="ion-edit"></i>
</a>
</span>
</div>
</li>
</ul>
</li>
<!-- First level -->
<li class="branch">
<!-- btn -->
<div class="d-flex justfiy-content-between">
<i class="ion-ios-plus-outline ml-2"></i>
<span class="toggler ml-3">لول اول</span>
<span class="btns d-flex">
<a class="bg-danger" href="">
<i class="ion-trash-b"></i>
</a>
<a class="bg-info mr-2" href="">
<i class="ion-edit"></i>
</a>
</span>
</div>
</li>
</ul>
I have a condition in this click function, it works nice. but it just works when I click on that button, but I want this condition to work outside this click function!

AJAX HTML breaks Divider

I am using AJAX and HTML to pull a name from a POST request, and then returning the data to fill a div with the response.
The data returns, but for some reason it breaks the div and adds a New Line to the equation, making the page look unprofessional.
<!DOCTYPE html>
<html lang="en">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>
function getSummary(id)
{
$.ajax({
type: "POST",
url: 'http://localhost/notyouraveragebear',
data: "username="+id,
success: function(data) {
document.getElementById("personname").innerText=data;
}
});
}
getSummary(1234);
</script>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>ArchServers Control Panel</title>
<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="css/sb-admin.css" rel="stylesheet">
<!-- Morris Charts CSS -->
<link href="css/plugins/morris.css" rel="stylesheet">
<!-- Custom Fonts -->
<link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div id="wrapper">
<!-- Navigation -->
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html">ArchServers Control Panel</a>
</div>
<!-- Top Menu Items -->
<ul class="nav navbar-right top-nav">
<li class="dropdown">
<i class="fa fa-envelope"></i> <b class="caret"></b>
<ul class="dropdown-menu message-dropdown">
<li class="message-preview">
<a href="#">
<div class="media">
<span class="pull-left">
<img class="media-object" src="http://placehold.it/50x50" alt="">
</span>
<div class="media-body">
<h5 class="media-heading"><strong>John Smith</strong>
</h5>
<p class="small text-muted"><i class="fa fa-clock-o"></i> Yesterday at 4:32 PM</p>
<p>Lorem ipsum dolor sit amet, consectetur...</p>
</div>
</div>
</a>
</li>
<li class="message-preview">
<a href="#">
<div class="media">
<span class="pull-left">
<img class="media-object" src="http://placehold.it/50x50" alt="">
</span>
<div class="media-body">
<h5 class="media-heading"><strong>John Smith</strong>
</h5>
<p class="small text-muted"><i class="fa fa-clock-o"></i> Yesterday at 4:32 PM</p>
<p>Lorem ipsum dolor sit amet, consectetur...</p>
</div>
</div>
</a>
</li>
<li class="message-preview">
<a href="#">
<div class="media">
<span class="pull-left">
<img class="media-object" src="http://placehold.it/50x50" alt="">
</span>
<div class="media-body">
<h5 class="media-heading"><strong>John Smith</strong>
</h5>
<p class="small text-muted"><i class="fa fa-clock-o"></i> Yesterday at 4:32 PM</p>
<p>Lorem ipsum dolor sit amet, consectetur...</p>
</div>
</div>
</a>
</li>
<li class="message-footer">
Read All New Messages
</li>
</ul>
</li>
<li class="dropdown">
<i class="fa fa-bell"></i> <b class="caret"></b>
<ul class="dropdown-menu alert-dropdown">
<li>
Alert Name <span class="label label-default">Alert Badge</span>
</li>
<li>
Alert Name <span class="label label-primary">Alert Badge</span>
</li>
<li>
Alert Name <span class="label label-success">Alert Badge</span>
</li>
<li>
Alert Name <span class="label label-info">Alert Badge</span>
</li>
<li>
Alert Name <span class="label label-warning">Alert Badge</span>
</li>
<li>
Alert Name <span class="label label-danger">Alert Badge</span>
</li>
<li class="divider"></li>
<li>
View All
</li>
</ul>
</li>
<li class="dropdown">
<i class="fa fa-user"></i> <div id = "personname"><p></p></div> <b class="caret"></b>
<ul class="dropdown-menu">
<li>
<i class="fa fa-fw fa-user"></i> Profile
</li>
<li>
<i class="fa fa-fw fa-envelope"></i> Inbox
</li>
<li>
<i class="fa fa-fw fa-gear"></i> Settings
</li>
<li class="divider"></li>
<li>
<i class="fa fa-fw fa-power-off"></i> Log Out
</li>
</ul>
</li>
</ul>
<!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav side-nav">
<li class="active">
<i class="fa fa-fw fa-dashboard"></i> Dashboard
</li>
<li>
<i class="fa fa-fw fa-bar-chart-o"></i> Charts
</li>
<li>
<i class="fa fa-fw fa-table"></i> Tables
</li>
<li>
<i class="fa fa-fw fa-edit"></i> Forms
</li>
<li>
<i class="fa fa-fw fa-desktop"></i> Bootstrap Elements
</li>
<li>
<i class="fa fa-fw fa-wrench"></i> Bootstrap Grid
</li>
<li>
<i class="fa fa-fw fa-arrows-v"></i> Dropdown <i class="fa fa-fw fa-caret-down"></i>
<ul id="demo" class="collapse">
<li>
Dropdown Item
</li>
<li>
Dropdown Item
</li>
</ul>
</li>
<li>
<i class="fa fa-fw fa-file"></i> Blank Page
</li>
<li>
<i class="fa fa-fw fa-dashboard"></i> RTL Dashboard
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</nav>
<div id="page-wrapper">
<div class="container-fluid">
<!-- Page Heading -->
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">
Dashboard <small>Statistics Overview</small>
</h1>
<ol class="breadcrumb">
<li class="active">
<i class="fa fa-dashboard"></i> Dashboard
</li>
</ol>
</div>
</div>
<!-- /.row -->
<div class="row">
<div class="col-lg-12">
<div class="alert alert-info alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<i class="fa fa-info-circle"></i> <strong>Like SB Admin?</strong> Try out SB Admin 2 for additional features!
</div>
</div>
</div>
<!-- /.row -->
<div class="row">
<div class="col-lg-3 col-md-6">
<div class="panel panel-primary">
<div class="panel-heading">
<div class="row">
<div class="col-xs-3">
<i class="fa fa-comments fa-5x"></i>
</div>
<div class="col-xs-9 text-right">
<div class="huge">26</div>
<div>New Comments!</div>
</div>
</div>
</div>
<a href="#">
<div class="panel-footer">
<span class="pull-left">View Details</span>
<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
<div class="clearfix"></div>
</div>
</a>
</div>
</div>
<div class="col-lg-3 col-md-6">
<div class="panel panel-green">
<div class="panel-heading">
<div class="row">
<div class="col-xs-3">
<i class="fa fa-tasks fa-5x"></i>
</div>
<div class="col-xs-9 text-right">
<div class="huge">12</div>
<div>New Tasks!</div>
</div>
</div>
</div>
<a href="#">
<div class="panel-footer">
<span class="pull-left">View Details</span>
<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
<div class="clearfix"></div>
</div>
</a>
</div>
</div>
<div class="col-lg-3 col-md-6">
<div class="panel panel-yellow">
<div class="panel-heading">
<div class="row">
<div class="col-xs-3">
<i class="fa fa-shopping-cart fa-5x"></i>
</div>
<div class="col-xs-9 text-right">
<div class="huge">124</div>
<div>New Orders!</div>
</div>
</div>
</div>
<a href="#">
<div class="panel-footer">
<span class="pull-left">View Details</span>
<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
<div class="clearfix"></div>
</div>
</a>
</div>
</div>
<div class="col-lg-3 col-md-6">
<div class="panel panel-red">
<div class="panel-heading">
<div class="row">
<div class="col-xs-3">
<i class="fa fa-support fa-5x"></i>
</div>
<div class="col-xs-9 text-right">
<div class="huge">13</div>
<div>Support Tickets!</div>
</div>
</div>
</div>
<a href="#">
<div class="panel-footer">
<span class="pull-left">View Details</span>
<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
<div class="clearfix"></div>
</div>
</a>
</div>
</div>
</div>
<!-- /.row -->
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><i class="fa fa-bar-chart-o fa-fw"></i> Area Chart</h3>
</div>
<div class="panel-body">
<div id="morris-area-chart"></div>
</div>
</div>
</div>
</div>
<!-- /.row -->
<div class="row">
<div class="col-lg-4">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><i class="fa fa-long-arrow-right fa-fw"></i> Donut Chart</h3>
</div>
<div class="panel-body">
<div id="morris-donut-chart"></div>
<div class="text-right">
View Details <i class="fa fa-arrow-circle-right"></i>
</div>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><i class="fa fa-clock-o fa-fw"></i> Tasks Panel</h3>
</div>
<div class="panel-body">
<div class="list-group">
<a href="#" class="list-group-item">
<span class="badge">just now</span>
<i class="fa fa-fw fa-calendar"></i> Calendar updated
</a>
<a href="#" class="list-group-item">
<span class="badge">4 minutes ago</span>
<i class="fa fa-fw fa-comment"></i> Commented on a post
</a>
<a href="#" class="list-group-item">
<span class="badge">23 minutes ago</span>
<i class="fa fa-fw fa-truck"></i> Order 392 shipped
</a>
<a href="#" class="list-group-item">
<span class="badge">46 minutes ago</span>
<i class="fa fa-fw fa-money"></i> Invoice 653 has been paid
</a>
<a href="#" class="list-group-item">
<span class="badge">1 hour ago</span>
<i class="fa fa-fw fa-user"></i> A new user has been added
</a>
<a href="#" class="list-group-item">
<span class="badge">2 hours ago</span>
<i class="fa fa-fw fa-check"></i> Completed task: "pick up dry cleaning"
</a>
<a href="#" class="list-group-item">
<span class="badge">yesterday</span>
<i class="fa fa-fw fa-globe"></i> Saved the world
</a>
<a href="#" class="list-group-item">
<span class="badge">two days ago</span>
<i class="fa fa-fw fa-check"></i> Completed task: "fix error on sales page"
</a>
</div>
<div class="text-right">
View All Activity <i class="fa fa-arrow-circle-right"></i>
</div>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><i class="fa fa-money fa-fw"></i> Transactions Panel</h3>
</div>
<div class="panel-body">
<div class="table-responsive">
<table class="table table-bordered table-hover table-striped">
<thead>
<tr>
<th>Order #</th>
<th>Order Date</th>
<th>Order Time</th>
<th>Amount (USD)</th>
</tr>
</thead>
<tbody>
<tr>
<td>3326</td>
<td>10/21/2013</td>
<td>3:29 PM</td>
<td>$321.33</td>
</tr>
<tr>
<td>3325</td>
<td>10/21/2013</td>
<td>3:20 PM</td>
<td>$234.34</td>
</tr>
<tr>
<td>3324</td>
<td>10/21/2013</td>
<td>3:03 PM</td>
<td>$724.17</td>
</tr>
<tr>
<td>3323</td>
<td>10/21/2013</td>
<td>3:00 PM</td>
<td>$23.71</td>
</tr>
<tr>
<td>3322</td>
<td>10/21/2013</td>
<td>2:49 PM</td>
<td>$8345.23</td>
</tr>
<tr>
<td>3321</td>
<td>10/21/2013</td>
<td>2:23 PM</td>
<td>$245.12</td>
</tr>
<tr>
<td>3320</td>
<td>10/21/2013</td>
<td>2:15 PM</td>
<td>$5663.54</td>
</tr>
<tr>
<td>3319</td>
<td>10/21/2013</td>
<td>2:13 PM</td>
<td>$943.45</td>
</tr>
</tbody>
</table>
</div>
<div class="text-right">
View All Transactions <i class="fa fa-arrow-circle-right"></i>
</div>
</div>
</div>
</div>
</div>
<!-- /.row -->
</div>
<!-- /.container-fluid -->
</div>
<!-- /#page-wrapper -->
</div>
<!-- /#wrapper -->
<!-- jQuery -->
<script src="js/jquery.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="js/bootstrap.min.js"></script>
<!-- Morris Charts JavaScript -->
<script src="js/plugins/morris/raphael.min.js"></script>
<script src="js/plugins/morris/morris.min.js"></script>
<script src="js/plugins/morris/morris-data.js"></script>
</body>
</html>
When i remove the div id personname, and insert just text there, such as my name Christopher, the content on the page appears correctly, without new lines.
As soon as I request the data and its returned and changed with the .textContent, the page adds line breaks and the page looks silly.
Any advice on this?
Here is the page with the replaced content.
http://imgur.com/a/29zAk
Here is the page with static content.
http://imgur.com/jPFLmJA
here is my server.js
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
app.use('/client', express.static(__dirname + '/public'));
app.use(bodyParser.urlencoded({extended: false}));
app.use(bodyParser.json());
app.listen(80, function () {
console.log('HTTPD Server Started');
});
app.post('/notyouraveragebear', function (req, res) {
res.send('Christopher');
console.log(req.body);
});
Thanks.

Bootstrap 3 Collapse - Change of icon with change of classes

Here's the fiddle: http://jsfiddle.net/krish7878/6xpdeLa6/
There are two div's .panel-heading and .panel-collapse. If .panel-collapse has class 'in' then a icon has to be added to .panel-heading. I have the jquery for it but the problem is the icons do not update when the class changes.
HTML Code:
<div class="sub-menu-1 panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
FASHION
</a>
</h4>
</div><!-- /.panel-heading -->
<div id="collapseOne" class="panel-collapse collapse in">
<div class="panel-body">
<ul class="list-normal sub-menu-list">
<li>
<a href="#">
<i class="fa fa-chevron-right"></i>
Man
</a>
</li>
<li>
<a href="#">
<i class="fa fa-chevron-right"></i>
Women
</a>
</li>
<li>
<a href="#">
<i class="fa fa-chevron-right"></i>
Children
</a>
</li>
<li>
<a href="#">
<i class="fa fa-chevron-right"></i>
Infants
</a>
</li>
</ul><!-- /.sub-menu-list -->
</div>
</div><!-- /#collapseOne -->
</div><!-- /.panel -->
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseTwo">
SPORTS
</a>
</h4>
</div><!-- /.panel-heading -->
<div id="collapseTwo" class="panel-collapse collapse">
<div class="panel-body">
<ul class="list-normal sub-menu-list">
<li>
<a href="#">
<i class="fa fa-chevron-right"></i>
Sports Gear
</a>
</li>
<li>
<a href="#">
<i class="fa fa-chevron-right"></i>
Sports Shoes
</a>
</li>
<li>
<a href="#">
<i class="fa fa-chevron-right"></i>
Discounted Stuff
</a>
</li>
<li>
<a href="#">
<i class="fa fa-chevron-right"></i>
Other Option
</a>
</li>
<li>
<a href="#">
<i class="fa fa-chevron-right"></i>
Other Option 2
</a>
</li>
<li>
<a href="#">
<i class="fa fa-chevron-right"></i>
Other Option 3
</a>
</li>
</ul><!-- /.sub-menu-list -->
</div><!-- /.panel-body -->
</div><!-- /#collapseTwo -->
</div><!-- /.panel -->
JS Code:
$(".panel-heading + .collapse:not(.in)").prev().append("<i class='fa fa-plus'></i>");
$(".panel-heading + .collapse.in").prev().append("<i class='fa fa-minus'></i>");
I think the code needs to be run each time the class changes but I'm not sure how to do it, any help would be appreciated.
JSFIDDLE
You can do like following:
$(document).ready(function(){
$(".panel-heading + .collapse:not(.in)").prev().append("<i class='fa fa-plus'></i>");
$(".panel-heading + .collapse.in").prev().append("<i class='fa fa-minus'></i>");
$('.panel-heading a').click(function(){
$('.panel').find('.collapse.in').prev().find("i").addClass("fa-plus").removeClass("fa-minus");
$(this).parents('.panel-heading').find("i.fa-plus").removeClass("fa-plus").addClass("fa-minus");
$(this).parents('.panel').find('.collapse.in').prev().find("i.fa-minus").removeClass("fa-minus").addClass("fa-plus");
});
});

Categories