SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Evangelist hantaah's Avatar
    Join Date
    Jul 2011
    Location
    Birmingham, Uk
    Posts
    562
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    What makes it rotate?

    If I have a website powered by wordpress, that has a main featured slider on the home page that rotates, what is it that makes it rotate?

  2. #2
    SitePoint Evangelist hantaah's Avatar
    Join Date
    Jul 2011
    Location
    Birmingham, Uk
    Posts
    562
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    I've been told it's javascript but is that what actually makes it rotate or is that jquery or what is the difference and can I see this by " inspecting elements " in the browser?

  3. #3
    Community Advisor silver trophybronze trophy
    dresden_phoenix's Avatar
    Join Date
    Jun 2008
    Location
    Madison, WI
    Posts
    2,816
    Mentioned
    34 Post(s)
    Tagged
    2 Thread(s)
    w/o knowing the specific code that question is hard to answer.


    Generally the following techniques are employed:

    1) for random STATIC images, WP may be using a PHP script. Building an array of image URLs, then using rand(0, count($your_array)-1); to pick an image at random.
    2) if its a SLIDE SHOW. then you do need .js of some sort. If this is the case ALL your images are present ALL the time and the scripts merely changes the position of the images to make one visible over the other (usually by changing CSS classes). If you were to turn off CSS and JS you SHOULD(not necessarily tho) see your entire slide show displayed as a plain list of images. the .js is probably executing on timeout(), to rotate the images at an interval. On your HTML try to locate this list ( or a DIV reaped around it) and see what ID/or class it has. You can then inspect your jQuery selectors for code that target that element or .js getElementByID('that elements ID')
    3) the other method, tho I cant think why WP would use this , employs AJAX. That is , the javascript is calling another document(page) and replacing it to create the slides. This method would not be as easy to spot simply by looking at view source or inspecting the element.

    Hope that helps

  4. #4
    SitePoint Evangelist hantaah's Avatar
    Join Date
    Jul 2011
    Location
    Birmingham, Uk
    Posts
    562
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Brilliant, it is as you said in #2. How enlightning, many thanks

  5. #5
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,863
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by hantaah View Post
    I've been told it's javascript ... or is that jquery or what is the difference
    jQuery is a library of functions that is written in JavaScript to perform common tasks that saves people with a reasonable but not expert level of JavaScript knowledge the trouble of creating their own library. You need a reasonable level of JavaScript knowledge to be able to use jQuery properly and if you have a high level of JavaScript knowledge you will likely have already created your own equivalent library and so would not need the jQuery one.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  6. #6
    SitePoint Wizard bronze trophy
    Join Date
    Oct 2001
    Location
    Vancouver BC Canada
    Posts
    2,033
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    For fading systems I use my own jQuery code but for a quick sliding banner system I use the jQuery Slides plugin. Have a look at it here: http://www.slidesjs.com/
    Andrew Wasson | www.lunadesign.org
    Principal / Internet Development

  7. #7
    SitePoint Evangelist hantaah's Avatar
    Join Date
    Jul 2011
    Location
    Birmingham, Uk
    Posts
    562
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    This thread has inspired me to take a developers course. After paying for a certified web developers course, I found out that there is no regulartory certificate for this field. Is this correct?

  8. #8
    SitePoint Wizard bronze trophy
    Join Date
    Oct 2001
    Location
    Vancouver BC Canada
    Posts
    2,033
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    None that I know of. Lots of technical colleges offer courses around here but they are only certified by themselves so... Not an industry standard by any stretch.
    Andrew Wasson | www.lunadesign.org
    Principal / Internet Development

  9. #9
    SitePoint Evangelist hantaah's Avatar
    Join Date
    Jul 2011
    Location
    Birmingham, Uk
    Posts
    562
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Just started my js course, I havn't got a clue what they are taking aboout. I'm hoping it will all become clear in time

  10. #10
    SitePoint Wizard bronze trophy
    Join Date
    Oct 2001
    Location
    Vancouver BC Canada
    Posts
    2,033
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Well, I suppose it all depends on what they are teaching you in the course. Web development takes shape in a variety of disciplines:

    1) HTML/CSS/Javascript - Primarily has to do with the user interface. This is called client side code.

    2) PHP, ASP.NET, Coldfusion, Classic ASP, Java Server Pages are server side technologies that run on the server and generate/serve client side code.

    3) MySQL, MS SQL Server, Access, SQL Lite, etc... are some of the databases that the server side code is used to store and retrieve data (content) on websites

    4) WordPress, Drupal, Joomla, Concrete5, Expression Engine, etc... are content management systems built upon the above three items to automate the process of building and maintaining modern websites.

    In my daily routine, depending on what I'm doing, I will typically write a smattering of PHP code, plus database SQL queries which will then be rendered as HTML often using Javascript and CSS to make the display more intuitive.

    My suggestion for someone new to the whole web development world would be to concentrate and master one area first. For instance, learn HTML/CSS so that you can look at a complex layout and intuitively know how you will render it as HTML using CSS to control how it all fits together; using background colours and css-gradients & opacity to manage drop shadows or overlaping areas.

    Once you've mastered that, I would suggest looking at using Javascript (one of the libraries like jQuery) to add some pizzazz to your layouts. I often use jQuery to display/hide messaging, validate forms or build tabbed catalogue pages.

    Also get a good book about PHP/MySQL to learn about how server-side code and databases interact to produce pages like the this forum page. Sitepoint has a ptretty good book right here: http://www.sitepoint.com/books/phpmysql5/
    Andrew Wasson | www.lunadesign.org
    Principal / Internet Development

  11. #11
    SitePoint Evangelist hantaah's Avatar
    Join Date
    Jul 2011
    Location
    Birmingham, Uk
    Posts
    562
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the good advice - sitepoint has really been helping me with my html and css so I'm getting more confident and getting a good understanding with it now. the js part of the course has just gone right over my head at the moment so I jumped the the php part as I'm more familiar with mysql and myphpadmin etc. Can you give me an example of a java scripted page as opposed to one that isn't javascripted to give me a better idea as to what it does and why and when I would use it?

  12. #12
    SitePoint Wizard bronze trophy
    Join Date
    Oct 2001
    Location
    Vancouver BC Canada
    Posts
    2,033
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Well, there are all sorts of reasons why you would use Javascript in a web page. Most often it is used to add some interactivity to a page; for instance to add a mini-calendar for a date field or to show and hide areas in a FAQ (frequently asked questions) section... That sort of thing. I also use it on occasion to call server-side scripts behind the scene to interact with the database or a web service and pull up results without having to do a full page request. That sort of thing is commonly known as an AJAX request.

    I used to write my javascript from scratch but now that Javascript libraries like jQuery, Dojo, YUI and many others are so well supported it just makes sense to grab one and learn it. The benefit of a library is that it abstracts a lot of the work involved in writing code to do something into a short concise statement and the library handles most browser compatibility issues, leaving you to write more maintainable code.

    I chose jQuery because it is relatively easy to latch on to and there is a lot of documentation about it on the web with examples of working code: http://jquery.com/
    Andrew Wasson | www.lunadesign.org
    Principal / Internet Development


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •