Text blinking jQuery
Try using this blink plugin
For Example
$('.blink').blink(); // default is 500ms blink interval.
//$('.blink').blink(100); // causes a 100ms blink interval.
It is also a very simple plugin, and you could probably extend it to stop the animation and start it on demand.
jQuery blink text for 1 minutes
One way of solving this, is by using setTimeOut()
: more info
In your case, you could add this to your code:
setTimeout(function() {
$(".blinker").unblink();
},60000)
The 60000
stands for 60 times 1000 milliseconds.
For the one time blinking: try adding a timespan:
$(".blinker").blink(500);
Edit: After some major debugging via StackOverflow chat, we found that there were some more issues with the code, preventing the solution above to work. In the end we solved it all. But the main answer for the question is in the solution above.
Blinking textbox value using jquery
first give the css, transition: color 0.3s;
and then:
$("#blinkchk").click(function(){
setInterval(function(){
$('#text').css('color','transparent');
setTimeout(function(){
$('#text').css('color','black');
},500);
},1000);
});
http://jsfiddle.net/8ebF6/
stop blinking text javascript
function blink(selector, repeat){
if(!repeat) return;
$(selector).fadeOut('slow', function(){
$(this).fadeIn('slow', function(){
blink(this, repeat - 1);
});
});
}
blink('.blink', 3);
So you can control how many times it will blink.
How to create a jQuery button with blinking text without changing the background colour?
You just have to call the animated function again after it has completed, like this.
var blink = function() {
$('a').animate({
opacity: '0'
}, function(){
$(this).animate({
opacity: '1'
}, blink);
});
}
blink();
Demo
If you don't want the background color to fade you may have to use a bit of css like this.
CSS:
a{
transition: color 200ms ease;
background:skyblue;
}
a.blink{
color:transparent;
}
Javascript:
window.setInterval(function(){
$('a').toggleClass('blink');
}, 500);
Demo
I would like to build the blinking text effect that changes? in css.
Hope this works for you.
document.addEventListener('DOMContentLoaded',function(event){ // array with texts to type in typewriter var dataText = [ "Amsterdam.", "Newyork", "Bengaluru", "sydney"]; // type one text in the typwriter // keeps calling itself until the text is finished function typeWriter(text, i, fnCallback) { // chekc if text isn't finished yet if (i < (text.length)) { // add next character to h1 document.querySelector("h1").innerHTML = text.substring(0, i+1) +'<span aria-hidden="true"></span>';
// wait for a while and call this function again for next character setTimeout(function() { typeWriter(text, i + 1, fnCallback) }, 100); } // text finished, call callback if there is a callback function else if (typeof fnCallback == 'function') { // call callback after timeout setTimeout(fnCallback, 700); } } // start a typewriter animation for a text in the dataText array function StartTextAnimation(i) { if (typeof dataText[i] == 'undefined'){ setTimeout(function() { StartTextAnimation(0); }, 20000); } // check if dataText[i] exists if (i < dataText[i].length) { // text exists! start typewriter animation typeWriter(dataText[i], 0, function(){ // after callback (and whole text has been animated), start next text StartTextAnimation(i + 1); }); } } // start the text animation StartTextAnimation(0);});
body { background-color: #ef3ef4; height: 100%; font-family: 'tradegothiclt-bold', sans-serif;}
h1 { font-size: 5em; color: white; text-transform: uppercase;}
span { border-right: .05em solid; animation: caret 1s steps(1) infinite;}
@keyframes caret { 50% { border-color: transparent; }}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <h1>Hallo, Wij zijn Occhio!</h1>
How to stop blinking when text is hovered?
The problem happens because the jQuery fadeOut
function sets display
of the element to none
along with changing opacity
to 0. Once the element's display
becomes none
, we are no longer hovering on the element even though the mouse is in the same position and so the hover out event kind of sets in, once this sets in and the fade-in is being done, the hover event again kicks in and it kind of goes into a cyclic loop.
One way to avoid the fadeOut
affecting the display
setting would be to manually set the display
to block
once the fade out is completed.
$('#hello').attr('data-originalText', function() { return (this.textContent || this.innerText).trim();}).hover(function() { $(this).stop().fadeOut(500, function() { $(this).css('display', 'block'); // added this line $(this).html('<a style="text-decoration:none; color:#222;" href="mailto:sfssfl.com">sfsfsfs@gmail.com</a>').stop().fadeIn(); }); },
function() { $(this).stop().fadeOut(800, function() { $(this).text($(this).attr('data-originalText')).stop().fadeIn(); }); });
.footer_5 { position: relative; display: flex; align-items: top; justify-content: center; top: 420px;}#hello { font-family: 'KeplerStd-MediumDisp'; font-size: 42px; letter-spacing: 1px; color: #222222; border-bottom: 3px solid #222222;}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><div class="footer_5"> <p id="hello"><span class="first">Please say hello.</span> </p></div>
JQuery Stop Text Flickering when Pressing Show Less / Show More
I hope that's what you wanted. You can do this easily by using .addClass
and .removeClass
Also. if you content and stories display as exactly as the example in question then .parent()
is not what you want you can call .prev()
and it will work just find.
Simple Show and Hide
Using addClass
and removeClass
Working Demo: https://jsfiddle.net/usmanmunir/cks8d067/
Run snippet below to see it working.
$(document).ready(function() {
$(".showMore").on("click", function() {
var $this = $(this);
var content = $this.prev()
var linkText = $this.text().toUpperCase();
if (linkText === "SHOW MORE") {
linkText = "Show less";
content.addClass("showContent").removeClass("hideContent");
} else {
content.addClass("hideContent").removeClass("showContent");
linkText = "Show more";
}
$this.text(linkText);
});
});
.hideContent {
overflow: hidden;
line-height: 1em;
height: 2em;
}
.showContent {
line-height: 1em;
height: auto;
}
.showMore {
cursor: pointer;
}
<div class="hideContent">
<div class="post-text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In id erat pharetra risus fermentum aliquam. Maecenas eu nisi posuere, rutrum orci et, imperdiet elit. Nulla tempor imperdiet sagittis. Aenean cursus justo ac enim lacinia vehicula. Etiam dictum
suscipit nibh, at iaculis velit lobortis vel. Duis pretium diam ut lectus mollis vehicula.</div>
<div class="post-action"><input type="button" value="Like" id="like_94" class="like"><span class="likesTotal" id="likes_94">0</span>
</div>
</div>
<div class="showMore"><a>Show more</a></div>
Related Topics
How to Programmatically Click a Link with JavaScript
Event When Window.Location.Href Changes
How to Get Jquery to Select Elements with a . (Period) in Their Id
Determine Original Size of Image Cross Browser
Es6 Variable Import Name in Node.Js
JavaScript Require() Function Giving Referenceerror: Require Is Not Defined
How to Make JavaScript Object Using a Variable String to Define the Class Name
JavaScript Removeeventlistener Not Working
Why Does JavaScript Object Show Different Values in Console in Chrome, Firefox, Safari
Maximum Item Size in Indexeddb
Insert Unicode Character into JavaScript
How to Get Text of an Input Text Box During Onkeypress
Ignore Mouse Interaction on Overlay Image