|
Page 1 of 1 |
|
Posted: Wed, 6th Aug 2014 11:54 Post subject: [jQuery] Showing div after another function has executed |
|
 |
I am looking for a way to show one div, only after the jquery script has executed in a previous div.
I have a stats counter, and the function looks like this:
Code: |
function counter($object,interval,max,increment) {
var number = parseInt($object.text(),10) + increment;
if (number < max){
setTimeout(function() {counter($object,interval,max,increment);} ,interval);
$object.text(number);
}
else{
$object.text(max);
}
}
|
You input your number and it will 'count' it to that number in a given interval of time. After that comes a div <div class="stats_number_sign"></div> that will put a sign of your choice inside.
At this moment, that sign will always be there, and then the counter starts, and it looks like I want, but, before the counter starts, the sign is just there. I found that I could just put the style="visibility:hidden;" on that div, and then change the css with jquery to visibility: visible after the number loads.
The issue is, to what do I point my new function that will change the visibility?
Code: | $(window).load(function () {
$('.stats_number_sign').css('visibility','visible');
} |
Is not working, since it waits for everything to be loaded, and is kinda breaking the function :\
Is there a function that will look when the previous one has ended loading and then it will do it's magic?
"Quantum mechanics is actually, contrary to it's reputation, unbeliveably simple, once you take the physics out."
Scott Aaronson chiv wrote: | thats true you know. newton didnt discover gravity. the apple told him about it, and then he killed it. the core was never found. |
|
|
Back to top |
|
 |
|
Posted: Thu, 7th Aug 2014 00:20 Post subject: |
|
 |
Last edited by Interinactive on Tue, 5th Oct 2021 01:53; edited 1 time in total
|
|
Back to top |
|
 |
|
Posted: Fri, 8th Aug 2014 18:29 Post subject: |
|
 |
Yeah, sorry I didn't respond, wasn't at home yesterday.
I don't think it'll be manageable, boss said I don't need to worry about it :\
"Quantum mechanics is actually, contrary to it's reputation, unbeliveably simple, once you take the physics out."
Scott Aaronson chiv wrote: | thats true you know. newton didnt discover gravity. the apple told him about it, and then he killed it. the core was never found. |
|
|
Back to top |
|
 |
|
Posted: Mon, 26th Jan 2015 17:25 Post subject: |
|
 |
im going to highjack this thread as I don't want to make another thread. anyways issue for me is I got information off from XML file and now i'd like to wrap html tags around the info, however no matter how i approach it, it is not working. for example I'm trying to get h4 tags around title. Here's my code so far.
Code: | $.ajax({
url:'xml/feed.xml',
dataType: 'xml',
success: function(data) {
$(data).find('channel item').each(function() {
var title = $(this).find('title').html();
var link = $(this).find('link').text();
var description = $(this).find('description').text();
var pubdate = $(this).find('pubdate').text();
var guid = $(this).find('guid').text();
var h1Title = document.createElement('h4');
var linktext = document.createTextNode(title);
h1Title.appendChild(linktext);
$('.timeline ul').append(
$('<li />', {
text: h1Title
}).addClass('myBox')
);
});
},
error: function() {
$('.timeline').text('Failed to get the feed');
}
}); |
|
|
Back to top |
|
 |
Page 1 of 1 |
All times are GMT + 1 Hour |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB 2.0.8 © 2001, 2002 phpBB Group
|
|
 |
|