demo page for the viewport.js library
viewport.js ships the document sections with additional properties containing the viewport scrolling position relatively to the sections. A custom scrolling indicator or an interactive navigation menu can then precisely reflect the scrolling state:
Bloomberg style:
Whatever
you invent

style:

Astronomy

The Almagest is the only surviving comprehensive ancient treatise on astronomy. Babylonian astronomers had developed arithmetical techniques for calculating astronomical phenomena; Greek astronomers such as Hipparchus had produced geometric models for calculating celestial motions. Ptolemy, however, claimed to have derived his geometrical models from selected astronomical observations by his predecessors spanning more than 800 years, though astronomers have for centuries suspected that his models' parameters were adopted independently of observations. Ptolemy presented his astronomical models in convenient tables, which could be used to compute the future or past position of the planets. The Almagest also contains a star catalogue, which is a version of a catalogue created by Hipparchus. Its list of forty-eight constellations is ancestral to the modern system of constellations, but unlike the modern system they did not cover the whole sky (only the sky Hipparchus could see). Through the Middle Ages, it was the authoritative text on astronomy, with its author becoming an almost mythical figure, called Ptolemy, King of Alexandria. The Almagest was preserved, like most of Classical Greek science, in Arabic manuscripts (hence its familiar name). Because of its reputation, it was widely sought and was translated twice into Latin in the 12th century, once in Sicily and again in Spain. Ptolemy's model, like those of his predecessors, was geocentric and was almost universally accepted until the appearance of simpler heliocentric models during the scientific revolution.

His Planetary Hypotheses went beyond the mathematical model of the Almagest to present a physical realization of the universe as a set of nested spheres, in which he used the epicycles of his planetary model to compute the dimensions of the universe. He estimated the Sun was at an average distance of 1,210 Earth radii, while the radius of the sphere of the fixed stars was 20,000 times the radius of the Earth.

Ptolemy presented a useful tool for astronomical calculations in his Handy Tables, which tabulated all the data needed to compute the positions of the Sun, Moon and planets, the rising and setting of the stars, and eclipses of the Sun and Moon. Ptolemy's Handy Tables provided the model for later astronomical tables or zījes. In the Phaseis (Risings of the Fixed Stars), Ptolemy gave a parapegma, a star calendar or almanac, based on the hands and disappearances of stars over the course of the solar year.

Geography

Ptolemy's other main work is his Geography (also called the Geographia). This also is a compilation of what was known about the world's geography in the Roman Empire during his time. He relied somewhat on the work of an earlier geographer, Marinos of Tyre, and on gazetteers of the Roman and ancient Persian Empire.

The first part of the Geography is a discussion of the data and of the methods he used. As with the model of the solar system in the Almagest, Ptolemy put all this information into a grand scheme. Following Marinos, he assigned coordinates to all the places and geographic features he knew, in a grid that spanned the globe. Latitude was measured from the equator, as it is today, but Ptolemy preferred to express it as climata, the length of the longest day rather than degrees of arc: the length of the midsummer day increases from 12h to 24h as one goes from the equator to the polar circle. In books 2 through 7, he used degrees and put the meridian of 0 longitude at the most western land he knew, the "Blessed Islands", often identified as the Canary Islands, as suggested by the location of the six dots labelled the "FORTUNATA" islands near the left extreme of the blue sea of Ptolemy's map here reproduced.

Ptolemy also devised and provided instructions on how to create maps both of the whole inhabited world (oikoumenè) and of the Roman provinces. In the second part of the Geography, he provided the necessary topographic lists, and captions for the maps. His oikoumenè spanned 180 degrees of longitude from the Blessed Islands in the Atlantic Ocean to the middle of China, and about 80 degrees of latitude from Shetland to anti-Meroe (east coast of Africa); Ptolemy was well aware that he knew about only a quarter of the globe, and an erroneous extension of China southward suggests his sources did not reach all the way to the Pacific Ocean.

The maps in surviving manuscripts of Ptolemy's Geography, however, only date from about 1300, after the text was rediscovered by Maximus Planudes. It seems likely that the topographical tables in books 2–7 are cumulative texts – texts which were altered and added to as new knowledge became available in the centuries after Ptolemy. This means that information contained in different parts of the Geography is likely to be of different dates.

Maps based on scientific principles had been made since the time of Eratosthenes, in the 3rd century BC, but Ptolemy improved map projections. It is known from a speech by Eumenius that a world map, an orbis pictus, doubtless based on the Geography, was on display in a school in Augustodunum, Gaul in the third century. In the 15th century, Ptolemy's Geography began to be printed with engraved maps; the earliest printed edition with engraved maps was produced in Bologna in 1477, followed quickly by a Roman edition in 1478 (Campbell, 1987). An edition printed at Ulm in 1482, including woodcut maps, was the first one printed north of the Alps. The maps look distorted when compared to modern maps, because Ptolemy's data were inaccurate. One reason is that Ptolemy estimated the size of the Earth as too small: while Eratosthenes found 700 stadia for a great circle degree on the globe, Ptolemy uses 500 stadia in the Geography. It is highly probable that these were the same stadion, since Ptolemy switched from the former scale to the latter between the Syntaxis and the Geography, and severely readjusted longitude degrees accordingly. See also Ancient Greek units of measurement and History of geodesy.

Because Ptolemy derived many of his key latitudes from crude longest day values, his latitudes are erroneous on average by roughly a degree (2 degrees for Byzantium, 4 degrees for Carthage), though capable ancient astronomers knew their latitudes to more like a minute. (Ptolemy's own latitude was in error by 14'.) He agreed (Geography 1.4) that longitude was best determined by simultaneous observation of lunar eclipses, yet he was so out of touch with the scientists of his day that he knew of no such data more recent than 500 years before (Arbela eclipse). When switching from 700 stadia per degree to 500, he (or Marinos) expanded longitude differences between cities accordingly (a point first realized by P.Gosselin in 1790), resulting in serious over-stretching of the Earth's east-west scale in degrees, though not distance. Achieving highly precise longitude remained a problem in geography until the invention of the marine chronometer at the end of the 18th century. It must be added that his original topographic list cannot be reconstructed: the long tables with numbers were transmitted to posterity through copies containing many scribal errors, and people have always been adding or improving the topographic data: this is a testimony to the persistent popularity of this influential work in the history of cartography.

Music

Ptolemy also wrote an influential work, Harmonics, on music theory and the mathematics of music. After criticizing the approaches of his predecessors, Ptolemy argued for basing musical intervals on mathematical ratios (in contrast to the followers of Aristoxenus and in agreement with the followers of Pythagoras), backed up by empirical observation (in contrast to the overly theoretical approach of the Pythagoreans). Ptolemy wrote about how musical notes could be translated into mathematical equations and vice versa in Harmonics. This is called Pythagorean tuning because it was first discovered by Pythagoras. However, Pythagoras believed that the mathematics of music should be based on the specific ratio of 3:2, whereas Ptolemy merely believed that it should just generally involve tetrachords and octaves. He presented his own divisions of the tetrachord and the octave, which he derived with the help of a monochord. Ptolemy's astronomical interests also appeared in a discussion of the "music of the spheres".

Optics

His Optics is a work that survives only in a poor Arabic translation and in about twenty manuscripts of a Latin version of the Arabic, which was translated by Eugene of Palermo (c. 1154). In it Ptolemy writes about properties of light, including reflection, refraction, and colour. The work is a significant part of the early history of optics and influenced the more famous 11th century Optics by Alhazen (Ibn al-Haytham). It contains the earliest surviving table of refraction from air to water, for which the values (with the exception of the 60° angle of incidence), although historically praised as experimentally derived, appear to have been obtained from an arithmetic progression.

The work is also important for the early history of perception. Ptolemy combined the mathematical, philosophical and physiological traditions. He held an extramission-intromission theory of vision: the rays (or flux) from the eye formed a cone, the vertex being within the eye, and the base defining the visual field. The rays were sensitive, and conveyed information back to the observer’s intellect about the distance and orientation of surfaces. Size and shape were determined by the visual angle subtended at the eye combined with perceived distance and orientation. This was one of the early statements of size-distance invariance as a cause of perceptual size and shape constancy, a view supported by the Stoics. Ptolemy offered explanations for many phenomena concerning illumination and colour, size, shape, movement and binocular vision. He also divided illusions into those caused by physical or optical factors and those caused by judgemental factors. He offered an obscure explanation of the sun or moon illusion (the enlarged apparent size on the horizon) based on the difficulty of looking upwards.

Astrology

Ptolemy has been referred to as “a pro-astrological authority of the highest magnitude”. His astrological treatise, a work in four parts, is known by the Greek term Tetrabiblos, or the Latin equivalent Quadripartitum: ‘Four Books’. Ptolemy's own title is unknown, but may have been the term found in some Greek manuscripts: Apotelesmatika, roughly meaning 'Astrological Outcomes,' 'Effects' or ‘Prognostics’.

As a source of reference, the Tetrabiblos is said to have "enjoyed almost the authority of a Bible among the astrological writers of a thousand years or more". It was first translated from Arabic into Latin by Plato of Tivoli (Tiburtinus) in 1138, while he was in Spain. The Tetrabiblos is an extensive and continually reprinted treatise on the ancient principles of horoscopic astrology. That it did not quite attain the unrivaled status of the Almagest was, perhaps, because it did not cover some popular areas of the subject, particularly electional astrology (interpreting astrological charts for a particular moment to determine the outcome of a course of action to be initiated at that time), and medical astrology, which were later adoptions.

The great popularity that the Tetrabiblos did possess might be attributed to its nature as an exposition of the art of astrology, and as a compendium of astrological lore, rather than as a manual. It speaks in general terms, avoiding illustrations and details of practice. Ptolemy was concerned to defend astrology by defining its limits, compiling astronomical data that he believed was reliable and dismissing practices (such as considering the numerological significance of names) that he believed to be without sound basis.

Much of the content of the Tetrabiblos was collected from earlier sources; Ptolemy's achievement was to order his material in a systematic way, showing how the subject could, in his view, be rationalized. It is, indeed, presented as the second part of the study of astronomy of which the Almagest was the first, concerned with the influences of the celestial bodies in the sublunar sphere. Thus explanations of a sort are provided for the astrological effects of the planets, based upon their combined effects of heating, cooling, moistening, and drying.

Ptolemy's astrological outlook was quite practical: he thought that astrology was like medicine, that is conjectural, because of the many variable factors to be taken into account: the race, country, and upbringing of a person affects an individual's personality as much as, if not more than, the positions of the Sun, Moon, and planets at the precise moment of their birth, so Ptolemy saw astrology as something to be used in life but in no way relied on entirely.

A collection of one hundred aphorisms about astrology called the Centiloquium, ascribed to Ptolemy, was widely reproduced and commented on by Arabic, Latin and Hebrew scholars, and often bound together in medieval manuscripts after the Tetrabiblos as a kind of summation. It is now believed to be a much later pseudepigraphical composition. The identity and date of the actual author of the work, referred to now as Pseudo-Ptolemy, remains the subject of conjecture.

gradient scrolling indicator implemented using intence
smooth programmatical scrolling (this is when you click a menu item) is performed with natural scroll