Need help to refresh pic on sidebar widget in wordpress

by 12 replies
16
Hi,

I have added a cam that upload a picture to a wordpress site that I want to auto refresh by itself but I don't want the page to refresh.

At the moment I have managed to get it to work if you click on a link the pic will refresh only and the page is not refreshed. It is part of a news site.

This is the code I found and is using. If anybody can help it would be much appreciated

cam.js

this code is added to the header.php in wordpress theme used

This is added in a txt widget in the sidebar

This working here http://whalecoasttimes.com on the top righthand side in the sidebar. Visitors have to refresh the pic. I want the pic to auto reload every 20-30 seconds without visitors having to do it.

I need to add that the pic must not refresh from the browser cache but when refresh reload from the server as this pic is uploaded from the cam every 15 seconds
#programming #pic #refresh #sidebar #widget #wordpress
  • If you don't have any conflicts the window.onload function anywhere else on the page, I'd pop this into cam.js
  • Better yet, since you have Jquery on the page:
    Then you can add the refreshcam class to all the streams you want to update every 20 seconds.
    • [1] reply
  • Jquery is on the site that you linked in the original post, but this page doesn't have Jquery on it. You can add it above that code and it should work properly:
    The setTimeout function accepts in Milliseconds, so the UpdateInSeconds is multiplied by 1000 to get the millisecond count.
  • Oops, Just realized I mistyped something when I was trying to consolidate that code. Go ahead and try this, I've tested it extensively this time
    • [ 1 ] Thanks
  • I added it but it does not seem to work

    http://whalecoasttimes.com/reload/index1.php
  • Updated it
  • is jQuery always called in a standard wordpress installation or in this case for that slider I am using?

    thanks working perfectly now, much appreciated your help
    • [1] reply
    • All current Wordpress installations use jQuery since the backend relies on it for some of its UI functionality. As long as your themes call the wp_head() function (and nearly all well coded themes do) and a theme or plugin doesn't explicitly remove it, it's safe to say it'll be there in the future. Those cases are especially rare, but even if it is removed, you can easily pop it back on the page.

      Sorry about all those revisions. I was writing that mostly from memory. I'll be sure to fully test things like that in the future before I post
      • [1] reply
  • Perfect should have worked that out. As you can see from that cam it is nearly midnight here by me so I better get some sleep.

    Again thanks a lot for your help.

Next Topics on Trending Feed