I am trying to hide an alert which is displayed inline using the slide function. It is displayed inline but the sliding doesn't happen inline like I intend it to happen. How can I make the sliding happen inline?
The following is the snippet with current code
$("#testDiv2").show();
$("#testDiv2").on('click', function () {
$("#testDiv2").hide('slide',{direction: 'left'}, 6000);
});
$(function() {
if ($("#testDiv2").is(':visible'))
$("#testDiv2").css('display','inline-block');
});
#test,#testDiv,#testDiv2 {
display:inline-block;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<div id="test">
A
<div id="testDiv2">
<div id="testDiv" class="alert alert-success">Click to close</div>
</div>
B
</div>
Related posts: