hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Web Design and Content : JS: How to refresh a div in javascript WITHOUT jquery/ajax
Reply

Forum Jump

JS: How to refresh a div in javascript WITHOUT jquery/ajax

Reply Post New Thread In Web Design and Content Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 05-15-2012, 02:24 PM
Mister Bark Mister Bark is offline
Junior Guru Wannabe
 
Join Date: Jun 2011
Location: Republic of Krakozhia
Posts: 90
Question

JS: How to refresh a div in javascript WITHOUT jquery/ajax


Hi!

I just made a simple javascript code that slides a div in another one by changing its css "left" property with a timer.

If I put an alert() at each loop, I see the animation of the div step by step at each alert message.
But if I remove the alert(), there is no animation, it goes straight to the end position, so I guess the problem is that the div needs some kind of refresh.
But I don't know how to do that!

PLEASE, I DO NOT WANT TO USE ANY MODULE such as ajax or jquery. I am sure there is a simple solution to do this.

Thanks a lot for your help!


HERE IS MY TEST PAGE :
http://img.misterbark.com/misterbark-homela-test.html

And the same without alert() :
http://img.misterbark.com/misterbark...t-noalert.html

__________________
FLORIAN BADOR - FLORIANBADOR.COM - FILM MUSIC COMPOSER



Sponsored Links
  #2  
Old 05-15-2012, 02:50 PM
Sam [Vissol] Sam [Vissol] is offline
Premium Member
 
Join Date: May 2007
Location: Cardiff, United Kingdom
Posts: 506
Personally I'd just use some CSS3.

Code:

#pagesky {
-moz-transition: left 0.5s;
-webkit-transition: left 0.5s;
transition: left 0.5s;

__________________
Sam Asante ~ Web & User Interface Designer ~ SamAsante.com
World-Class cPanel Themes
Responsive WHMCS Themes



  #3  
Old 05-15-2012, 02:52 PM
Mister Bark Mister Bark is offline
Junior Guru Wannabe
 
Join Date: Jun 2011
Location: Republic of Krakozhia
Posts: 90
Thanks but the point is to control it with the NEXT and PREVIOUS buttons

__________________
FLORIAN BADOR - FLORIANBADOR.COM - FILM MUSIC COMPOSER

Sponsored Links
  #4  
Old 05-15-2012, 03:35 PM
Sam [Vissol] Sam [Vissol] is offline
Premium Member
 
Join Date: May 2007
Location: Cardiff, United Kingdom
Posts: 506
Quote:
Originally Posted by Mister Bark View Post
Thanks but the point is to control it with the NEXT and PREVIOUS buttons
You can

__________________
Sam Asante ~ Web & User Interface Designer ~ SamAsante.com
World-Class cPanel Themes
Responsive WHMCS Themes



  #5  
Old 05-15-2012, 03:43 PM
Mister Bark Mister Bark is offline
Junior Guru Wannabe
 
Join Date: Jun 2011
Location: Republic of Krakozhia
Posts: 90
oh really??? how

Otherwise, I found a solution that works :
http://img.misterbark.com/misterbark...a-test-ok.html

apparently setTimeout is not nice, I used setInterval here.

__________________
FLORIAN BADOR - FLORIANBADOR.COM - FILM MUSIC COMPOSER

  #6  
Old 05-15-2012, 03:50 PM
Sam [Vissol] Sam [Vissol] is offline
Premium Member
 
Join Date: May 2007
Location: Cardiff, United Kingdom
Posts: 506
Quote:
Originally Posted by Mister Bark View Post
oh really??? how
Just add the code I posted to your CSS and it will work perfectly!

__________________
Sam Asante ~ Web & User Interface Designer ~ SamAsante.com
World-Class cPanel Themes
Responsive WHMCS Themes



  #7  
Old 05-15-2012, 03:59 PM
Mister Bark Mister Bark is offline
Junior Guru Wannabe
 
Join Date: Jun 2011
Location: Republic of Krakozhia
Posts: 90
hmm I see that's great hehe
So you basically use javascript only to change the left property and the movement is smooth cool

But the problem is always the same.... internet explorer.... I have to be a stupid programmer because internet explorer is stupid...

__________________
FLORIAN BADOR - FLORIANBADOR.COM - FILM MUSIC COMPOSER

Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
Jquery: Automatically Hidden Div, Toggle to Show insomnia24/7 Programming Discussion 7 05-13-2012 03:38 PM
How to make page title, auto refresh every x seconds (using javascript/jquery/others) basketmen Web Design and Content 3 05-07-2012 04:31 PM
jquery vs ie7, scrollable div layer streetmedia Web Design and Content 1 07-02-2009 02:39 PM
Ajax - refresh - ram BELLonline Programming Discussion 5 04-30-2008 12:59 PM
Refresh itsems in a <div> element each 10 secs mikey1090 Programming Discussion 3 08-24-2006 02:02 PM

Related posts from TheWhir.com
Title Type Date Posted


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?