In my project I'm using accordion, but the "active" state only works in the click event. I need it to work when active. When active, it shows the minus sign and plus sign when not active. I am using ACF in Wordpress.
My PHP code:
<div class="accordian-boxed"><br>
<?php if(get_field('bio_bl2_accordion')):
$dig_count=0; ?>
<ul class="accordion-box">
<?php while(has_sub_field('bio_bl2_accordion')):
if ($dig_count == 0) { ?>
<li class="accordion block">
<div class="acc-btn">
<div class="icon-outer">
<span class="icon icon-plus fa fa-plus"></span>
<span class="icon icon-minus fa fa-minus"></span>
</div>
<?php the_sub_field('ac_titulo');?>
</div>
<div class="acc-content current">
<div class="content">
<div class="text">
<p><?php the_sub_field('ac_descricao');?></p>
</div>
</div>
</div>
</li>
<?php } else {?>
<li class="accordion block">
<div class="acc-btn">
<div class="icon-outer">
<span class="icon icon-plus fa fa-plus"></span>
<span class="icon icon-minus fa fa-minus"></span>
</div>
<?php the_sub_field('ac_titulo');?>
</div>
<div class="acc-content">
<div class="content">
<div class="text">
<p><?php the_sub_field('ac_descricao');?></p>
</div>
</div>
</div>
</li>
<?php }
$dig_count++; ?>
<?php endwhile; ?>
</ul>
<?php else : endif; ?>
My JS code:
if($('.accordion-box').length){
$('.accordion-box').on('click', '.acc-btn', function() {
var target = $(this).parents('.accordion');
if($(this).hasClass('active')!==true){
$('.accordion .acc-btn').removeClass('active');
}
if ($(this).next('.acc-content').is(':visible')){
//$(this).removeClass('active');
return false;
//$(this).next('.accord-content').slideUp(300);
}else{
$(this).addClass('active');
$('.accordion').removeClass('active-block');
$('.accordion .acc-content').slideUp(300);
target.addClass('active-block');
$(this).next('.acc-content').slideDown(300);
}
});
}
See the image:
The icons state image
Can someone help me?
Thanks
Related
I have a collapsible FAQ section that sits on each members profile page. I'd like to hide the question and answer if the data field is empty.
<div class="row">
<div class="col-md-10">
<div class="panel panel-default1">>
<div class="panel-heading">
<h3 class="panel-title"><b>Who is the registered manager of <?php echo $user['full_name']?>?</b></h3>
<span class="pull-right clickable"><i class="glyphicon glyphicon-chevron-up"></i></span>
</div>
<div class="panel-body">
<?php echo $user['registered_manager']?> is the registered manager of <?php echo $user['full_name']?>.
</div>
</div> </div>
<div class="col-md-10">
<div class="panel panel-default2">
<div class="panel-heading">
<h3 class="panel-title"><b>How many beds are there at <?php echo $user['full_name']?>?</b></h3>
<span class="pull-right clickable"><i class="glyphicon glyphicon-chevron-up"></i></span>
</div>
<div class="panel-body">
There are <?php echo $user['number_of_beds']?> beds in total at <?php echo $user['full_name']?>.</div>
</div> </div>
<div class="col-md-10">
<div class="panel panel-default3">
<div class="panel-heading">
<h3 class="panel-title"><b>Who owns <?php echo $user['full_name']?>?</b></h3>
<span class="pull-right clickable"><i class="glyphicon glyphicon-chevron-up"></i></span>
</div>
<div class="panel-body">
<?php echo $user['full_name']?> is owned and operated by <?php echo $user['group_name']?>.</div>
</div> </div>
</div>
</div>
<script type="text/javascript">
jQuery(function ($) {
$('.panel-heading span.clickable').on("click", function (e) {
if ($(this).hasClass('panel-collapsed')) {
// expand the panel
$(this).parents('.panel').find('.panel-body').slideDown();
$(this).removeClass('panel-collapsed');
$(this).find('i').removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up');
}
else {
// collapse the panel
$(this).parents('.panel').find('.panel-body').slideUp();
$(this).addClass('panel-collapsed');
$(this).find('i').removeClass('glyphicon-chevron-up').addClass('glyphicon-chevron-down');
}
});
});
</script>
.panel-heading span
{
margin-top: -20px;
font-size: 15px;
}
.row
{
margin-top: 40px;
padding: 0 20px;
}
.clickable
{
cursor: pointer;
}
The $user['full_name'] will always be populated so I don't need to worry about that. In question one the field that needs to not be blank is $user['registered_manager']
Question 2 is $user['number_of_beds'] and Question 3 is ```<?php echo $user['group_name']
thanks in advance
You can achieve that by adding CSS class .hidden and checking if $user is empty in PHP
CSS:
.hidden { display: none; }
PHP:
<div class="col-md-10 <?php if( empty($user['registered_manager']) ) echo 'hidden' ?> ">
<div class="panel-heading">
<h3 class="panel-title">
<b>Who is the registered manager of <?php echo $user['full_name']?>
</b>.
</h3>
<span class="pull-right clickable"><i class="glyphicon glyphicon-chevron-up"></i></span>
</div>
<div class="panel-body">
<?php echo $user['registered_manager']?> is the registered manager of <?php
echo $user['full_name']?>.
</div>
</div>
You can wrap parts of your html with php if statement which says when to render it. For example this part willl be only rendered when $user['full_name'] is not falsy (empty string, null, zero...).
<?php if ($user['full_name']): ?>
<div class="col-md-10">
...
<?php echo $user['full_name']?>
...
</div>
<?php endif ?>
See more examples here: https://www.w3schools.com/php/php_if_else.asp
i have a software which passed a unique id to the url of my clients but limitation of my software is that is passes the unique id in the end of the url and sometimes link are too long and we want to pass id inbetween the url like www.zyx.com?id=i want to pass id here in between &jsabdkhbdf&sdkjbahdb&kjdsbkfbskdb&pid=jdndhf
i have seeen a software where is you to pass id in between you type like this ?id=[%id%] where every in url i type this parameter will pass there idk how its hapenning there pls help pasting the code
<?php require_once("session.php" );?>
<?php include("header.php"); require_once("dbcon.php");?>
<div class="navbar-default sidebar" role="navigation">
<div class="sidebar-nav navbar-collapse">
<ul class="nav" id="side-menu">
<li class="sidebar-search">
<div class="input-group custom-search-form">
<input type="text" class="form-control" placeholder="Search...">
<span class="input-group-btn">
<button class="btn btn-default" type="button">
<i class="fa fa-search"></i>
</button>
</span>
</div>
</li>
<li>
<i class="fa fa-dashboard fa-fw"></i> Dashboard<br>
</li>
<li>
<i class="fa fa-bar-chart-o fa-fw"></i> Survey<span class="fa arrow"></span>
<ul class="nav nav-second-level">
<li>
New Survey
Add Clients
Clients List
</li>
<li>
Survey List
</li>
</ul>
<!-- /.nav-second-level -->
</li><br>
<li>
<i class="fa fa-table fa-fw"></i>Add Vendor
Vendor List
</li>
<li>
<!-- /.nav-second-level -->
</li>
</ul>
</div>
<!-- /.sidebar-collapse -->
</div>
<!-- /.navbar-static-side -->
<nav>
<div id="page-wrapper">
<div class="row">
<div class="col-lg-8 ">
<h1 class="page-header">Dashboard</h1>
</div>
<!-- /.col-lg-12 -->
</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-check-circle fa-5x"></i>
</div>
<div class="col-xs-9 text-right">
<?php
$sql = "SELECT COUNT(status) as count from new_survey WHERE Status LIKE 'open%'";
$result = $conn->query($sql);
while($rows = $result->fetch_assoc() )
echo "<div class='huge'>{$rows['count']}</div>";
?>
<div>Surveys Completed</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">New</div>
<div>Survey</div>
</div>
</div>
</div>
<a href="new_survey.php">
<div class="panel-footer">
<span class="pull-left">Create New Survey</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-ban fa-5x"></i>
</div>
<div class="col-xs-9 text-right">
<?php
$sql = "SELECT COUNT(status) as count from new_survey WHERE Status LIKE 'close%'";
$result = $conn->query($sql);
while($rows = $result->fetch_assoc() )
echo "<div class='huge'>{$rows['count']}</div>";
?>
<div>InCompleted Surveys</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">
<?php
$sql = "SELECT COUNT(status) as count from new_survey WHERE Status LIKE 'invoice%'";
$result = $conn->query($sql);
while($rows = $result->fetch_assoc() )
echo "<div class='huge'>{$rows['count']}</div>";
?>
<div>Invoiced Surveys</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>
<div class="panel panel-default">
<div class="panel-heading">
Survey List
</div>
<div class="panel-body">
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover" width="100%" border="1">
<thead><tr>
<th>Survey ID</th>
<th>Client Name</th>
<th>Survey Name</th>
<th>Client Live URL</th>
<th>Client Test URL</th>
<th>Completed</th>
<th>InCompleted</th>
<th>Quota Full</th>
<th>Time Period</th>
<th>Creation Date</th>
<th>End Date</th>
<th>Status</th>
<th>Edit</th>
</tr>
</thead>
<tbody>
<?php
**this is unique parameter**
**$a = bin2hex(random_bytes(10));**
$sql = "SELECT * from new_survey where survey_id order by survey_id desc";
$result = $conn->query($sql);
while($rows = $result->fetch_assoc() ){
echo "<tr>";
echo " <td>{$rows['survey_id']}</td>";
echo " <td>{$rows['client_name']}</td>";
echo "<td>{$rows['survey_name']}</td>";
here it is passing when fetching the url from database onclick of link
**echo "<td> <a href=". $rows['client_live_url'] . urlencode($a) . "&s_id=" . $rows['survey_id'] . " target='_blank'> Click Here </a></td>";**
echo "<td> Click Here </td>";
echo" <td>{$rows['completed']}</td>";
echo "<td>{$rows['incompleted']}</td>";
echo "<td>{$rows['quota_full']}</td>";
echo" <td>{$rows['time_period']}</td>";
echo" <td>{$rows['creation_date']}</td>";
echo" <td>{$rows['end_date']}</td>";
echo" <td>{$rows['status']}</td>";
echo" <td><a href=\"edit_survey.php?id={$rows['survey_id']}\">Edit</td>";
echo "</tr>";
}
$conn->close();
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- /#page-wrapper -->
<div class="panel-footer">
<div class="text-center">
<?php echo date('Y'); ?>, ©
<?php echo "$copyright"; ?>
</div>
</div>
<!-- /#wrapper -->
<!-- jQuery -->
<script src="./vendor/jquery/jquery.min.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="./vendor/bootstrap/js/bootstrap.min.js"></script>
<!-- Metis Menu Plugin JavaScript -->
<script src="./vendor/metisMenu/metisMenu.min.js"></script>
<!-- Morris Charts JavaScript -->
<script src="./vendor/raphael/raphael.min.js"></script>
<script src="./vendor/morrisjs/morris.min.js"></script>
<script src="./data/morris-data.js"></script>
<!-- Custom Theme JavaScript -->
<script src="./dist/js/sb-admin-2.js"></script>
I need help on this I don't know if it a mistake here because the comment is not displayed, I submit the comment and I see it in the database but it's doesn't show on unfortunately.
popuptweets.php
<?php
include '../init.php';
if (isset($_POST['showpopup']) && !empty($_POST['showpopup'])) {
$tweetID = $_POST['showpopup'];
$user_id = $_SESSION['user_id'];
$tweet = $getFromT->getPopupTweet($tweetID);
$user = $getFromU->userData($user_id);
$likes = $getFromT->likes($user_id, $tweetID);
$retweet = $getFromT->checkRetweet($tweetID, $user_id);
$comments = $getFromT->comments($tweetID);
?>
<div class="tweet-show-popup-wrap">
<input type="checkbox" id="tweet-show-popup-wrap">
<div class="wrap4">
<label for="tweet-show-popup-wrap">
<div class="tweet-show-popup-box-cut">
<i class="fa fa-times" aria-hidden="true"></i>
</div>
</label>
<div class="tweet-show-popup-box">
<div class="tweet-show-popup-inner">
<div class="tweet-show-popup-head">
<div class="tweet-show-popup-head-left">
<div class="tweet-show-popup-img">
<img src="<?php echo BASE_URL.$tweet->profileImage;?>"/>
</div>
<div class="tweet-show-popup-name">
<div class="t-s-p-n">
<a href="<?php echo BASE_URL.$tweet->username;?>">
<?php echo $tweet->screenName;?>
</a>
</div>
<div class="t-s-p-n-b">
<a href="<?php echo BASE_URL.$tweet->username;?>">
#<?php echo $tweet->username;?>
</a>
</div>
</div>
</div>
<div class="tweet-show-popup-head-right">
<button class="f-btn"><i class="fa fa-user-plus"></i> Follow </button>
</div>
</div>
<div class="tweet-show-popup-tweet-wrap">
<div class="tweet-show-popup-tweet">
<?php echo $getFromT->getTweetLinks($tweet->status);?>
</div>
<div class="tweet-show-popup-tweet-ifram">
<?php if(!empty($tweet->tweetImage)){?>
<img src="<?php echo BASE_URL.$tweet->tweetImage;?>"/>
<?php }?>
</div>
</div>
<div class="tweet-show-popup-footer-wrap">
<div class="tweet-show-popup-retweet-like">
<div class="tweet-show-popup-retweet-left">
<div class="tweet-retweet-count-wrap">
<div class="tweet-retweet-count-head">
RETWEET
</div>
<div class="tweet-retweet-count-body">
<?php echo $tweet->retweetCount;?>
</div>
</div>
<div class="tweet-like-count-wrap">
<div class="tweet-like-count-head">
LIKES
</div>
<div class="tweet-like-count-body">
<?php echo $tweet->likesCount;?>
</div>
</div>
</div>
<div class="tweet-show-popup-retweet-right">
</div>
</div>
<div class="tweet-show-popup-time">
<span><?php echo $tweet->postedOn;?></span>
</div>
<div class="tweet-show-popup-footer-menu">
<ul>
<?php if($getFromU->loggedIn() === true){
echo '<li><i class="fa fa-share" aria-hidden="true"></i></a></button></li>
<li>'.(($tweet->tweetID === $retweet['retweetID']) ? '<button class="retweeted" data-tweet="'.$tweet->tweetID.'" data-user="'.$tweet->tweetBy.'"><a href="#"><i class="fa fa-retweet" aria-hidden="true"></i><span class="retweetsCount">'.$tweet->retweetCount.'</span></button>' : '<button class="retweet" data-tweet="'.$tweet->tweetID.'" data-user="'.$tweet->tweetBy.'"><a href="#"><i class="fa fa-retweet" aria-hidden="true"></i><span class="retweetsCount">'.(($tweet->retweetCount > 0) ? $tweet->retweetCount : '').'</span></button>').'</li>
<li>'.(($likes['likeOn'] === $tweet->tweetID) ? '<button class="unlike-btn" data-tweet="'.$tweet->tweetID.'" data-user="'.$tweet->tweetBy.'"><i class="fa fa-heart-o" aria-hidden="true"></i><span class="likesCounter">'.$tweet->likesCount.'</span></button>' : '<button class="like-btn" data-tweet="'.$tweet->tweetID.'" data-user="'.$tweet->tweetBy.'"><i class="fa fa-heart" aria-hidden="true"></i><span class="likesCounter">'.(($tweet->likesCount > 0) ? $tweet->likesCount : '').'</span></button>').'</li>
<li>
<i class="fa fa-ellipsis-h" aria-hidden="true"></i>
<ul>
<li><label class="deleteTweet">Delete Tweet</label></li>
</ul>
</li>';
}else{
?>
<li><button type="buttton"><i class="fa fa-share" aria-hidden="true"></i></button></li>
<li><button type="button"><i class="fa fa-retweet" aria-hidden="true"></i><span class="retweetsCount">RETWEET-COUNT</span></button></li>
<li><button type="button"><i class="fa fa-heart" aria-hidden="true"></i><span class="likesCount">LIKES-COUNT</span></button></button></li>
<?php }?>
</ul>
</div>
</div>
</div><!--tweet-show-popup-inner end-->
<?php if($getFromU->loggedIn() === true){?>
<div class="tweet-show-popup-footer-input-wrap">
<div class="tweet-show-popup-footer-input-inner">
<div class="tweet-show-popup-footer-input-left">
<img src="<?php echo BASE_URL.$user->profileImage?>"/>
</div>
<div class="tweet-show-popup-footer-input-right">
<input id="commentField" type="text" data-tweet="<?php echo $tweet->tweetID;?>" name="comment" placeholder="Reply to #<?php echo $tweet->username;?>">
</div>
</div>
<div class="tweet-footer">
<div class="t-fo-left">
<ul>
<li>
<label for="t-show-file"><i class="fa fa-camera" aria-hidden="true"></i></label>
<input type="file" id="t-show-file">
</li>
<li class="error-li">
</li>
</ul>
</div>
<div class="t-fo-right">
<span id="count">140</span>
<input type="submit" id="postComment" value="Tweet">
<script type="text/javascript" src="<?php echo BASE_URL;?>assets/js/comment.js"></script>
</div>
</div>
</div><!--tweet-show-popup-footer-input-wrap end-->
<?php }?>
<div class="tweet-show-popup-comment-wrap">
<div id="comments">
<?php
foreach ((array)$comments as $comment) {
echo '<div class="tweet-show-popup-comment-box">
<div class="tweet-show-popup-comment-inner">
<div class="tweet-show-popup-comment-head">
<div class="tweet-show-popup-comment-head-left">
<div class="tweet-show-popup-comment-img">
<img src="'.BASE_URL.$comment->profileImage.'">
</div>
</div>
<div class="tweet-show-popup-comment-head-right">
<div class="tweet-show-popup-comment-name-box">
<div class="tweet-show-popup-comment-name-box-name">
'.$comment->screenName.'
</div>
<div class="tweet-show-popup-comment-name-box-tname">
#'.$comment->username.' - '.$comment->commentAt.'
</div>
</div>
<div class="tweet-show-popup-comment-right-tweet">
<p>#'.$tweet->username.' '.$comment->comment.'</p>
</div>
<div class="tweet-show-popup-footer-menu">
<ul>
<li><button><i class="fa fa-share" aria-hidden="true"></i></button></li>
<li><i class="fa fa-heart-o" aria-hidden="true"></i></li>
<li>
<i class="fa fa-ellipsis-h" aria-hidden="true"></i>
<ul>
<li><label class="deleteTweet">Delete Tweet</label></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</div>
<!--TWEET SHOW POPUP COMMENT inner END-->
</div>
';
}
?>
</div>
</div>
<!--tweet-show-popup-box ends-->
</div>
</div>
<?php
}
?>
comment.js
$(function () {
$(document).on('click', '#postComment', function(){
var comment = $('#commentField').val();
var tweet_id = $('#commentField').data('tweet');
if(comment !=""){
$.post('http://localhost/twitter/core/ajax/comment.php', {comment:comment,tweet_id:tweet_id}, function(data){
$('#comments').html(data);
$('#commentField').val("");
});
}
})
});
commnet.php
<?php
include '../init.php';
if (isset($_POST['comment']) && !empty($_POST['comment'])) {
$comment = $getFromU->checkInput($_POST['comment']);
$user_id = $_SESSION['user_id'];
$tweetID = $_POST['tweet_id'];
if (!empty($comment)) {
$getFromU->create('comments',array('comment' => $comment, 'commentOn' => $tweetID, 'commentBy' => $user_id, 'commentAt' => date('Y-m-d H:i:s')));
$comments = $getFromT->comments($tweetID);
$tweet = $getFromT->getPopupTweet($tweetID);
foreach ((array)$comments as $comment) {
echo '<div class="tweet-show-popup-comment-box">
<div class="tweet-show-popup-comment-inner">
<div class="tweet-show-popup-comment-head">
<div class="tweet-show-popup-comment-head-left">
<div class="tweet-show-popup-comment-img">
<img src="'.BASE_URL.$comment->profileImage.'">
</div>
</div>
<div class="tweet-show-popup-comment-head-right">
<div class="tweet-show-popup-comment-name-box">
<div class="tweet-show-popup-comment-name-box-name">
'.$comment->screenName.'
</div>
<div class="tweet-show-popup-comment-name-box-tname">
#'.$comment->username.' - '.$comment->commentAt.'
</div>
</div>
<div class="tweet-show-popup-comment-right-tweet">
<p>#'.$tweet->username.' '.$comment->comment.'</p>
</div>
<div class="tweet-show-popup-footer-menu">
<ul>
<li><button><i class="fa fa-share" aria-hidden="true"></i></button></li>
<li><i class="fa fa-heart-o" aria-hidden="true"></i></li>
<li>
<i class="fa fa-ellipsis-h" aria-hidden="true"></i>
<ul>
<li><label class="deleteTweet">Delete Tweet</label></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</div>
<!--TWEET SHOW POPUP COMMENT inner END-->
</div>
';
}
}
}
?>
Those are all codes I used so how can I solve the problem?
As we have investigated the problem was in missing return
I have this chat box and this go_to_top icon. Is that possible to hide the icon when the box is clicked and open, and display it again when its closed?
This is how it looks in my local host (view extern):
This my ChatBox code
<section class="btn-xs bd-section-5 hidden-xs bd-page-width bd-tagstyles" id="section5" data-section-title="Section">
<div class="bd-container-inner bd-margins clearfix">
<div class=" bd-layoutbox-9 bd-page-width bd-no-margins clearfix">
<div type="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" class="chatbutton bd-container-inner btn btn-default">
<h4 class=" bd-textblock-11 bd-content-element">
<span style="font-weight: normal;">Call us on</span> 0800 0125 888
</h4>
</div>
<div class="panel-collapse collapse" id="collapseOne">
<div class="panel-body">
<ul class="chat">
<li class="left clearfix"><span class="chat-img pull-left">
<img src="./assets/images/<?php echo ($cruise_avatar[0]); ?>.png" alt="<?php echo ($cruise_avatar[0]); ?>" class="img-circle" />
</span>
<div class="chat-body clearfix">
<div class="header">
<strong class="primary-font"><?php echo ($cruise_avatar[1]); ?></strong> <small class="pull-right text-muted">
<span class="glyphicon glyphicon-time"></span><?php echo date("h:i:s A"); ?></small>
</div>
<p>
<?php echo ($cruise_avatar[2]); ?>
</p>
</div>
</li>
<li class="right clearfix"><span class="chat-img pull-right">
<img src="http://placehold.it/50/FA6F57/fff&text=ME" alt="User Avatar" class="img-circle" />
</span>
<div class="chat-body clearfix">
<div class="header">
<small class=" text-muted"><span class="glyphicon glyphicon-time"></span><?php echo date("h:i:s A"); ?></small>
<strong class="pull-right primary-font">Bhaumik Patel</strong>
</div>
<p>
<?php echo ($cruise_avatar[2]); ?>
</p>
</div>
</li>
</ul>
</div>
<div class="panel-footer">
<div class="input-group">
<input id="btn-input" type="text" class="form-control input-sm" placeholder="Type your message here..." />
<span class="input-group-btn">
<button class="btn btn-warning btn-sm" id="btn-chat">
Send</button>
</span>
</div>
</div>
</div>
</div>
</div>
</section>
And that's it looks like this when clicked (view extern):
I tried to hide it with jQuery like this: UPDATE it to
<script>
$(document).ready(function(){
$(".bd-layoutbox-9").click(function(){
if ($("span.bd-icon-67.bd-icon").css("display","inline-block")){
$("span.bd-icon-67.bd-icon").css("display","none");
}
else if ($("span.bd-icon-67.bd-icon").css("display","none")){
$("span.bd-icon-67.bd-icon").css("display","inline-block");
}
});
});
</script>
and my span code
<div data-smooth-scroll data-animation-time="250" class=" bd-smoothscroll-3">
<span class="bd-icon-67 bd-icon "></span>
</div>
I can hide it when Chatbox is open, but when i close it is not displayed again.
On a click on the image I have to show a hidden div with effects such as scroll down automatically to the bottom
my code looks like:
$(document).ready(function() {
$('#test').click(function() {
$('.contact-form').toggle("100");
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<section id="contact" status="closed">
<div class="container-fluid">
<div class="row">
<div class="col-xs-12">
<div class="contact-nav"></div>
<div class="contact-form-trigger open" id="test">
<img src="<?php echo base_url('assets/images/dugh1.png')?>" class="doug img-resfponsive hidden-xs" alt="Doug the man!">
</div>
</div>
</div>
</div>
<div class="color-div"></div>
<div class="contact-form " style="display: none;">
<div class="container-fluid">
<div class="row">
<div class="col-md-6">
<div class="address">
<div class="address-div">
<h3>Address</h3>
<h5><?php echo $company[1]->content; ?>
</h5>
<h5>Phone: <?php echo $company[2]->content; ?></h5>
<a href="#">
<?php echo $company[3]->content; ?></a>
</div>
<div class="social-icons">
<h4>follow us</h4>
<ul class="list-inline">
<li><a class="social-icon" href="<?php echo $company[7]->content; ?>"><i class="fa fa-facebook"></i></a>
</li>
<li><a class="social-icon" href="<?php echo $company[8]->content; ?>"><i class="fa fa-twitter"></i></a>
</li>
<li><a class="social-icon" href="<?php echo $company[9]->content; ?>"><i class="fa fa-linkedin"></i></a>
</li>
<li><a class="social-icon" href="<?php echo $company[10]->content; ?>"><i class="fa fa-dribbble"></i></a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
By using this script i can show the hidden div but it not scrolling down automatically.Now my need is to make it possible scroll down automatically when clicked on the image dugh1.png to show hidden div. what should I have to done for making that possible. I am very new to java script. Thanking in advance.
you could try doing something like this mate
$(document).ready(function() {
$('#test').click(function() {
$('.contact-form').toggle("100");
$('html, body').animate({
scrollTop: $('footer').offset().top
}, 'slow');
});
});
or check this just customize it to your needs.
var objDiv = document.getElementById("your_div");
objDiv.scrollTop = objDiv.scrollHeight;
you can use this snippet