Marquee text with close button using jquery | Sanwebcorner

Marquee text with close button using jquery

In this post i will tell you how to create close button in marquee text with the help of jquery and html. You can manually closing flash news section using jquery below javascript code is used to enable the close button in marquee div.

<script>
$(document).ready(function(c) {
$('.alert-close').on('click', function(c){
$('.message').fadeOut('slow', function(c){
$('.message').remove();
});
});
});
</script>

This types of flash news section most of the website now using to display the emergency flash news section dynamically using some technology. This types of marquee text with close button is one of the user friendly because when user don't want that message simple they close the section so none of the  flash news text will disturb the customers. Below i given full code and also i given demo link below you just check it out how it is working and also i given the download button download the code and use it, I hope this simple example is really helpful.



Code for Flash news with close button

<html>
<head>
<title>manually closing flash news section </title>
<style>
.alert {
background-color: #f39c12 !important;

}

.message {
border-radius: 2px;
display: block;
font-size: 10pt;
font-weight: bold;
margin: 0 0 15px;
padding: 10px 10px 10px 35px;
position: relative;
vertical-align: middle;
color: white;
}
.alert-close {

border-radius: 50%;
background-color: #F7C575;
color: #000;
opacity: .6;
cursor: pointer;
font-size: 18px;
font-weight: normal;
height: 22px;
line-height: 21px;
position: absolute;
right: 11px;
text-align: center;
top: 9px;
-webkit-transition: color 0.2s ease-in-out;
-moz-transition: color 0.2s ease-in-out;
-o-transition: color 0.2s ease-in-out;
transition: color 0.2s ease-in-out;
width: 22px;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(c) {
$('.alert-close').on('click', function(c){
$('.message').fadeOut('slow', function(c){
$('.message').remove();
});
});
});
</script>
</head>
<body>
<div class="message alert"><marquee style="width:75%;">Flash News: This is manually closing flash news section jquery flash news. You can close this div by clicking the close button. </marquee>
<div class="alert-close"> x </div>
</div>
</body>
</html>

Post a Comment

Labels

360 degree view product image 3d rotate 3d text 3step-form Accordion menu ajax All Browsers Animated Background Gradient animation audio controller auto complete Best accordion menu bootstrap border bounce effect on hover Breadcrumb calculate age by dob calendar Captcha change image on mouse move color chooser countdown Counter on scroll Css css animation css buttons css hover css3 customized upload Button Date picker delete data from table Different scroll speed email otp verification email verifier Embed eventlist Expanding Menu feedbck form flash news section close button full screen menu Google custom search Google Maps Google reCAPTCHA Google site search gradient hide menu Horizontal News ticker Hover Htm Html html dropdown html form html5 html5 form validation Iframe image hover increment decrement textbox value based on select box Javascript Jquery js Layered image effect on mouse hover lock & unlock page scroll marquee marquee with close button mobile number validation mobile otp login Multi-level-drop-down-menu multi-level-form Multi-Step-form mysql News ticker on hover change text to image our team page password strength checker Photoshop PHP populate html selectbox Popup image on click the link pure css Question type form Random password Redirect page Based on the select box while submit the form responsive responsive menu responsive popup box Responsive Vertical Time line design rotate image selectbox based on select box simple coming soon page simple countdown based on end date simple typing effect slider sliding tab sms otp login statistic counter on scroll switch tag shape team member Time picker toggle toggle view transparent button underline animation up down slide validation vertical fixed sidebar Webtips Youtube