I have a problem with my updateprogress. Its working, but I want a close button to close it. Its not problem yet, but I want to display this button after display of updateprogress in 30 sec. I tried do it with jquery, but it didnt work.
Can you help me?
Here is a sample. My problem is, that I dont know, what kind of event show the updateprogress.
$('.UpdateProgress').on('display', function () {
$('.btnClose').hide(0).delay(30000).show(0);
});
I tried display, show, focus event, but I dont know how to do this.
Set your button to hidden to start:
<style>
input.btnClose
{
display: none;
}
</style>
<input type="submit" class="btnClose">
Now use setTimeout to show() it after 30000ms (30 seconds):
<script type="text/javascript">
$(document).ready(function(){
$('.UpdateProgress').on('display', function () {
setTimeout("showDelay();", 30000);
});
});
function showDelay() {
$('.btnClose').show();
}
</script>
Related
I want my "X" button on website to appear every 30 seconds or so. So when people visit my site, they can close the "X" button and after they close, the "X" button will show up again in 30 seconds or so. How is it possible? I know how to delay the button to show
<script src="https://code.jquery.com/jquery-1.11.3.js"></script>
<script>
$(document).ready(function () {
// Hide the div
$("#button1").hide();
// Show the div after 2s
$("#button1").delay(2000).fadeIn(100);
});
</script>
Thanks for help
tell it to show every 30s.
setInterval(function(){
$('#button1').show();
},30000);
I would just add an onclick method for your button, and when it is triggered you do the same thing as when you fade in the button at start (hide then delay a fadein).
should be somthing like
<script src="https://code.jquery.com/jquery-1.11.3.js"></script>
<script>
$(document).ready(function () {
// Hide the div
$("#button1").hide();
// Show the div after 2s
$("#button1").delay(2000).fadeIn(100);
$("#button1").onclick(function() {
$("#button1").hide();
// Show the div after 30s
$("#button1").delay(30000).fadeIn(100);
});
});
</script>
I'm new to jQuery and been trying to figure this out.
I have a course assignment where I have to make an event handler for a page unload in JQuery that when fired will fadeout(3000) a div and then the text 'Thank you' will fadein(3000). I'm assuming what the instructor means is to have a button or link that leaves the window and goes to another page but first executes the fadeIn/FadeOut.
I'm not having any issues w/ the FadeIn/FadeOut option. I'm having the issue w/ the unload ... how do I get it to go to a new page but first execute a fadeOut(2000)/fadeIn(2000)?
I'm having a problem figuring this out. As far as I understand unload is compatable only w/ $(window), so the only that I can really do is have an alert?
This is what I have so far, but this is not an unload, I'm trying to figure out how to have this effect work once you are unloading. Is that even possible?
JQ
$(function () {
$(".btn1").click(function () {
$("#fadeout").fadeOut(3000);
$("#thankyou").fadeIn(3000);
});
});
CSS
btn1 {
display:none;}
HTML
<button id="btn1" class="btn1">CLICK</button>
Would I add a delay to close the window and link something else at the same time when you hit the button?
$(".btn1").click(function() {
$("#fadeout").fadeOut(3000, function() {
$("#thankyou").fadeIn(3000, function() {
location="url";
});
});
});
#thankyou {
display: none
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id='fadeout'>Hello World!</div>
<div id='thankyou'>Thank you!</div>
<button class='btn1'>Click</button>
This?
I am programming a survey online and want to delay the next button. I have the following code but I would like to improve it:
<script type="text/javascript">
$(document).ready(function(){
$("div.submit_div").slideUp(00).delay(10000).fadeIn(1000);
});
</script>"
I have two ideas, and will appreciate code for any of them:
-Is there any way to add a text that says "please note the button will appear in 10 seconds" while the button is being delayed?
-Is it possible to disable the button and present it with opacity, until the count down finishes and makes it possible to click it?
Assuming $("div.submit_div") to be the said button.
$(document).ready(function(){
$("div.submit_div").hide();
setTimeout(function() {
$("#init_text").remove();
$("div.submit_div").show();
}, 10000);
});
You can make one more div which shows the text you wanted to show while the button is hidden and manipulate that div similar to submit_div button.
Add <div id="init_text"> Please complete survey</div> before the code for the submit button.
Of course you can do it with success callback in animation.
<script type="text/javascript">
$(document).ready(function() {
$("div.submit_div").slideUp(00, function() {
/*
disable button here using `prop('disable',true)`
and do the rest
*/
}).delay(10000).fadeIn(1000, function() {
/*
enable button here using `prop('disable',false)`
and do the rest
*/
});
});
</script>
I am currently trying to show a div 2 seconds after the page is loaded. I can successfully do the reverse by hiding the div two seconds after the page loads. The issue is that nothing occurs and the div stays hidden. How can I properly show a div after two seconds of page load? Extra: mean while the two seconds are running show an ajax loading gif and then fade in the div
<script type = "text/javascript">
$(window).load(function() {
setTimeout(function() {
$("#contentPost").show('fadeIn', {}, 500)
}, 2000);
});
</script>
html/css
<style>
.contentPost { display:none;}
</style>
<div class="contentPost">
<h2>Hi there</h2>
</div>
$(document).ready(function() {
$(".contentPost").delay(2000).fadeIn(500);
});
Will work perfectly.
Ive never seen your show method written like that. Try altering it into use the jquery method fadeIn:
<script>
$(function() {
$("#contentPost").delay(2000).fadeIn(500);
});
</script>
The show method does not accept any arguments and won't work as you want it to.
Ok this is my problem that no one can seem to answer. I have two javascripts in use. Once is for the popup I have and tells it to stay closed for 24hrs when closed. The other is to put a link some where on the page to display this popup until refreshed and kept hidden till the cookie expires. Now the div popup is set to display:none. The cookie tells it to be shown until the close button is pressed. No matter what I seem to rework in my javascript to tempoarly show the popup from a link, it will not show. Some how the cookie javascript is going to have to be modified and thus having to remove css:display:none on the popup div. I have no idea what to do.
This is the current code:
http://jsfiddle.net/Dv7DR/-
http://pastebin.com/fHvv5spn
<script type="text/javascript">
$("#linkshow").click(function {
$("#window").show()
});
</script>
Submit a comment
<div id="window">
...
<div>
<script type="text/javascript">
...cookie popup hide for 24hr on close
</script>
Note: I have already tried:
$(document).ready(function() {
$("#linkshow").click(function(e) {
e.preventDefault();
$("#window").show();
});
});
and...
$(document).ready(function() {
$("#window").hide();
$("#linkshow").live('click', function(e) {
e.preventDefault();
$("#window").show();
});
});
and...
$(function() {
$("#linkshow").click(function() {
$("#window").show()
});
});
and...
<div id="window" style="display:none;">
to
<div id="window">
Then the other 24hr cookie javascript doesn't keep the popup hidden. I am assuming I need to take out the id="window" style="display:none; and some how advanced the javascript cookie at the bottom the code so it will hide when asked to be hidden for 24hr and show when needed to be shown on the current page until refresh but I am at blank on what to do.
Your syntax is wrong, Try
$(document).ready(function() {
$("#linkshow").click(function(e) {
e.preventDefault();
$("#window").show();
});
});
Works for me: See jsFiddle
You need to wrap your code in a DOM ready handler, and you also missed the brackets following the function declaration. Try this:
<script type="text/javascript">
$(function() {
$("#linkshow").click(function() {
$("#window").show()
});
});
</script>