Front End Design

Front End Design

Layout may look unique and unusual, but should be primarily based on content. Visitor should get the information he is looking for in the shortest way possible. Best idea were to find the right balance between individual look and approved, familiar markup.
Read more
Responsive design is absolute must nowadays and it is important that a site should be developed for all screen sizes and resolutions to be viewed on every device and platform without the loss of functionality. One shouldnt dismiss the issue of compatibility with different browsers
Read more
Adding custom scripts to your page, will allow visitors to interact with your website. For example, some scripts add search boxes, guest books, discussion boards, shopping carts, elements animation or whatever else that can increase conversion rate.
Read more
Statistics data data from your site can provide important insight into your visitors habits and interests. It is highly reasonable to keep track of at least most common metrics that describe your site performance.
Read more
Uploading web site files on the server is an important part of work. Server should be correctly configured to be ranged with search engines and files should be deployed in appropriate hierarchy and order to provide safe functioning. Highly recommendable is the use of SSL certificate.
Read more
Code snippets, layout tricks, markup ideas. Just a depositary of code that can be implemented somewhere
Read more
Site maintenance, content managing, site updates
Read more
Weather Online
Display weather forecast worldwide

Where you have to start, when you want to make weather forecast app, is to find out the coordinates.
The simplest way to find out these, were to ask your brouser. Most brousers provide geolocation data and can give you exact location data.
Good idea woud be to use promise, while you can not be sure that requited data will be ready quick enough to use it in your weather app.

let getLocationPromise = () => {
return new Promise(function (resolve, reject) 
{navigator.geolocation.getCurrentPosition((position) => resolve(position),(error) => reject(error));});};
function getLocation() {
getLocationPromise().then((res) => {const { coords } = res;
document.getElementById("divWhereToPutCoordinates").innerHTML = `
latitude : ${coords.latitude}
longitude : ${coords.longitude}`;})}
 

The only problem with this approach is, that sometimes geolocation function is switched off in brousers for privacy reasons. If brouser is not allowed to provide geolocation info, the whole app will stuck.
To avoid this one can hardcode the coordinates of desired locations - this easiest decision, when you know for sure where you want the weather to be displayed. It is good idea to take the easiest and simplest way-overclevered and fancy projects are the first to collapse in case.
But one more problem persists-you need to know the current time up to hour at the desired location to display weather. Most obvious idea is to use toLocaleString("en-US", options), limit output in options to hours and use this for your app.

const hours = new Date();
const options = {
timeZone:"America/New_York",
//weekday: "long",
 // year: "numeric",
hourCycle:"h24",
hour:"numeric"
};
hours.toLocaleString("en-US", options);

This obvious approach though will return something like '05' for New York, which will have to be proceeded somehow for futher use. In case you have limited number of locations where you want to display weather or even one singular location, there is a simpler way. Hardcode time difference. You system will easily provide you the standard time with js function:getUTCHours() Since I have already hardcoded the coordinates for location, why not to hard code time difference of these location with standard time?

const citiesObj = [
{
    "latitude": 35.41,
    "longitude": 139.43,
    "timeZoneDifference": 9,
    "name": "Asia/Tokyo"
  },
 .....
 ]

For example you can set time difference of '9' for Tokyo. After you got 10 through getUTCHours() as standard time on your visitors machine, then adding 10 and 9, you know for sure that local time at the moment in Tokio- 19.00. So since we have coordinates and local time we can ask weather service for weather.
Good people from weather service return a huge bulk of information, which we do not need for simplified scope of this app.
Good idea is to receive whole weather info as JSON object.
After that I can deconstruct this object, selecting only data I need-hourly weather info.

let weather = await fetch(weatherServiceApi);
  let rawData = await weather.json();
  const {current,hourly}=rawData;
 
All I need after is to populate result string with extracted data.

Weather Worldwide onclick

You can get more interesting results, when you click map for coordinates and use this to receive weather info for this partucular location in real time. I have example of such app on my snippets page and explain approach there.

Work timesheet online
Vacations,sickleave,absent online schedule

Here is the example of online schedule, where one can track vacations, sickleave or absent days of employees.

Schedule can be easily administered through back office form, which stores date into mySQL

Application allows to read the amount of work, sickleave and no-show days within the selected period. Just click firstly start and then end date to see the result. To see working example load application and select 2024 in select box. All demo entries refer to this year.

Rate

Training new foreign language vocabulary online

One of the numerous ways to train new vocabulary online.

Students must drag the marker on the object and enter the right word into text input slot

If everything is correct, tutor confirms the result - everything can be be observed with other members of group in real time online.

Selected word or sentence can be played back. One can select voice, rate and pitch settings

Drag label




Vector based simulations

Great effects through simple methods

If you put aside all huge buzz around AI, you will stay with a simple case, when object , moving along its path, encounters obstacle or similar problem, and tries to solve it, find way around, using algirithms it has on board. This 'reactive machine' type of behaviour can be easily demonstrated with an example below.

It's not serious, really. But one can see how interesting and realistic natural simulations can look like, being achieved with simple methods

You can drag obstacles to make it difficult for the rocket to avoid them

Start/Stop Rocket


Rocket moves around it's space, changing angle and direction each time it meets bounaries.
Random motion is simulated through the piece of code, which allows rocket to find a way around each time it approaches obstacle

Rocket loops through array of obstacles coordinates and calculate distance from each of them.
If it gets too close to one of obstacles, angle will be calculated.

To avoid obstacle mutual attraction formula will be used.
If mutual attraction will be calculated as follows:


F = (G m_1 m_2 / r^2)* r For repellence simulation we do not need G constant and masses, but take negative value, while we need change direction of rocket. Translated into code repellence formula can be written as simple as that:


var force = -1 * someModulator/ (mag * mag);

After that BC -normalized vector, multiplied by 'force', will be subtracted from velocity vector AB. Result -vector AC safely takes rocket away from obstacle. Picture displays general approach-for our purpuses we need normalized vectors.

This a very simple simulation example. More interesting version is 3d space for rocket. Anyway it s interesting how many ideas can be realized with rather simple methods. Lots of inspiring ideas could be found in 'Nature of Code'- book by Daniel Shiffman

Css Perspecive Example
Usind css 3d to create rotating menu

One can achieve interesting effect using css perspective and 3d to build rotating selector image, to let user select the service or topic. Click on the image to rotate it.

I have added a couple of layers on front and back side, which contain clouds, air balloon, airplane and their shadows to make 3d effect more realistic.

After selector image makes it 180 deg turn after user clicks it, the new set of links will be displayed beneath.

Links are displayed in random order and are turned to random angle.

Start/Stop morphing

English
English
Rate

Flickering Image Effect

Image morphing

Animated blocks of web-pages belong to history. One reason for that is that Adobe Flash was not supported for several years and most popular browsers excluded it's plugin for good

Another reason for that could be lack of demand for the animated content-public was more interested in flat, easily undersood pages.

Web turned into market place in last decade-and customers should get shortest way to 'pay' button. Any distraction here was not welcome.

Though one can still experiment with CSS, canvas and Javascript to achieve most interesting effects. You can select the image you want to be morphed, clicking on thumbs below. Slider range changes the size of grain.

Start/Stop


Snow
Forest
Mountains

Animating SVG Filters

Animating SVG Filters

Using SVG can add considerable advantage to the looks of your webpage. Vector graphic instruments allow to add visual elements to page to enhance its visual performance

More interesting could be to use SVG filters and even animate properties of these filters.

One of mostly interesting filters is Perlin Noise. Though one should keep usage of such elements limited.

Below is the example of such animated filter. Flag blowing in the wind is most trivial way to illustrate Perlin Noise in action.

Snow
Forest
Mountains
Mountains
Mountains
Mountains

Start/Stop morphing

Firstly you need to define filter. Add filter id to css definition of element



<svg xmlns="http://www.w3.org/2000/svg" 
xmlns:xlink="http://www.w3.org/1999/xlink" id="svgNoise" class="u-svg-none">
<defs>
    <filter id="noiseEffect" 
    filterUnits="objectBoundingBox" x="0%" y="0%" width="100%" height="100%">
      <feTurbulence type="fractalNoise" 
      baseFrequency="0.003" numOctaves="1" seed="1" 
      stitchTiles="stitch" result="particle">
      <feDisplacementMap scale="80" 
      in="SourceGraphic" in2="particle" 
      xChannelSelector="R" yChannelSelector="G">
        
      </feDisplacementMap>

	</defs>  
    
  </svg>



Set js function to animate filter. Filter is just part of DOM and you can assign JS variable name to it


const filter = document.querySelector("#noiseEffect");
let bf=0.001;
let runs=false;
var sd=1;
let sc=80;
  const filterElement = filter.querySelector('feTurbulence');
  const filterElement1 = filter.querySelector('feDisplacementMap');
  document.getElementById('btn').addEventListener("change", function () {
if(!runs){
interVal=setInterval(step, 200);
runs=true;
}
else{
clearInterval(interVal);
 runs=false;}
  });

To animate filter call function step() each 200 msc to change filter attributes. It requires sertain effort to ajust interval and attribute range to modify for the final result to look good. Here is a quick and rough solution, but it is place to start.

To achieve 'flag in the wind' effect i modify base frequency within 0.004 and 0.008, scale within 80 to 110. Exeeding these valued leed to distortion of image.


let bfi=1;
let sci=1;

function step(){

sd+=1;

if(bf>=0.008){bfi=-1;}
if(bf<=0.004){bfi=1;}
if(sc>=110){sci=-1;}
if(sc<=80){sci=1;}
bf+=0.0002*bfi;
sc+=3*sci;
filterElement.setAttribute('seed', sd);
filterElement.setAttribute('baseFrequency', bf);
filterElement1.setAttribute('scale', sc);
} 


Rate

Curved Div Outlines

Custom Curved Div Outlines
Curved Divs

There are sertain themes and site types, where you can try to apply more flexible approaches as commonly used square corners layouts. This is quite simple idea and requires not too muuch effort, but needs sertain adjusting if you want all curves to displeay nicely on different screens and resolutions.

Second heading

You can design form of div with css clip-path: polygon(.....) property. Any shape can be created , using this approach. Everything outside shape will stay transparent. This can give designer unlimited possibilities to create interesting overlapping image patterns. Width and height of div must be set in usual way.

3d Heading

Intersting effect can be achieved if any next layer will overlap over preceeding one. Set backgrounds of divs to different colors for the border between layers could stand out more distinctly. You dont have to get things complicated with z-index properties of divs, just set margin-top property of any next layer to negative value for it could overlap.

Last Heading

It is worth while mentioning , that since you have applied curved outlines to layer, it is reasonable to use svg text-path method to adjust text path to the outline of div.

<svg class=art viewBox="10 -37 650 150">
<path id="curve" d="M 0 50 Q 100 0 200 0 Q 300 0 400 50 Q 600 100 750 0" fill="none"/>
<text id=header3 class=svgText width="100" style="fill:#ffcc00;">
<textPath xlink:href="#curve" startOffset="12%>
Heading Text
</textPath>
</text>
</svg>

Calculating conversion

Calculate conversion on you web page

Whatever site you run, it is designed to generate conversions. People read articles, subscribe to news, download documents, checking out product descriptions before adding them to shopping cart -all that can be evaluated through conversion rate trackers.

It is important to know, what sections of web site or products are mostly interesting to your visitors, to add or remove them to increase conversion. There are lots of offers out there with heatmaps and session recordings plugins, where sophisticated software tracks users behaivoiur and offers solutions.

But sometimes things should not be that complicated. Especially when you run small business and do not need/can not afford complex conversion analytics

To find out what layout template on my templates page gets most views , I simply let function, attached to "View more" button, change variable, responsible for clicked product, from "0" to "1". I know now, that user viewed this product and is potentially interested in it. You, on your side, may have there product cards with videos, cats food, hand made mugs, bycicle spare parts etc..etc..on you page- as a result you will get list of products, that people would bue.


function linksTrack(variable responsible for particular product){
window['variable responsible for particular product']=1;
}

After visitor leaves page, I have an array of variables, indicating clicked/not clicked product cards. Using 'onbeforeunload' handler I send them to back end page, which calculates conversion.


window.addEventListener('beforeunload', (event) => {
navigator.sendBeacon("handleDuration.php", data);
delete event['returnValue'];
});

Conversion is calculated to following formula


Conversion = (Conversions/Number of visitors)*100

Results will be stored and used later to build a nice diagram to display user preferences. Actually this simplified example represents general approach used im most complicated solutions.

To visualise the results , I used great collection of Google charts- very useful instrument to display on your web site any type of statisics data. Many thanks to Google team for their great work.

Rate

JSON and MySql

Fetch data fom MySql DB with JSON

Example implements JSON. JSON is collection of name/value pairs in text format. Virtually all modern programming languages support them in one form or another.
1) Quiery string (default-"all") is sent to server php file
xmlhttp.send("x="+quiery string);
2) Php file addresses MySql database and fetches corresponding data.
Data ,received from database would be encoded as JSON
$JSONstring = json_encode($dataFromMySql);
3) XMLHttpRequest parses received data
JSON.parse(this.responseText);
4) Table would be built in a loop

Text on web page

Let header rotate

Text on Webpage

Website texts are the most important part of web sites. This is why user comes to site. These texts are created especially for use on the Internet.

Some specific features differentiate website texts from printed texts. One should implement specific HTML design and think on SEO optimization.

  • The paragraphs should be short. Each paragraph deals with no more than one subject matter.
  • The text must be divided into many subheadings.
  • The text should include links.

Though sometimes you may be interested in some uncommon text display.Check web page template with rotating menu, to see how this approach can be implemented

Acctually there is no limit beside you imagination on how you display text on your page. One should be careful though and avoid approaches that can make it difficult to perceive the content

Heading with splitted text

Heading are the first point,where the content would be evaluated and visitor takes decision if he is interested to stay longer on page

Atrract attention here is an effort worth while. Below is splitted heading made with svg

HEADING HEADING HEADING

Such text block could be successful when it contributes to the user performing the desired conversion. These texts generally work according to a simple principle – first by arousing interest, and then by providing a quick and simple solution. Though you schould be careful about any text effects that can provide difficulties for user to read it quickly. Remember that any animation effects should be implemented only at the point, where they are appropriate.

Text around shapes

Sometimes you do not need rectangular forms of images on page, but may be interested in more natural, curved outlines. There is no better way to convey pleasant, informal, relaxing atmospere, as to use pictures, where background surfaces seem to be cut out and text floats accurately around the outlines of objects, depicted on photo. To achieve this effect CSS offers great tool-the whole collection of shape instruments. After you selected the picure and decided where you want to place it, you have to define polygon coordinates to let text float nicely around the image area. Select text with your mouse to see the image-polygon shape outlines.
Here is just the simples example, but imagine what individual note such approach can provide to web page. Padding and margin properties can be also set appropriately, if visual implementation demands it.

This is class definition in style section:.img1{ float:right; clip-path:polygon(51px 132px, 23.06% 27.06%, 13.79% 19.38%, 31.55% 11.10%, 35.77% -0.16%, 100.03% 0.02%, 100.4% 98.77%, 81.31% 86.61%, 72.12% 76.51%, 57.38% 75.78%, 44.93% 71.17%, 18.38% 70.93%, 0px 204px, -1.06% 43.03%); shape-outside:polygon(51px 132px, 23.06% 27.06%, 13.79% 19.38%, 31.55% 11.10%, 35.77% -0.16%, 100.03% 0.02%, 100.4% 98.77%, 81.31% 86.61%, 72.12% 76.51%, 57.38% 75.78%, 44.93% 71.17%, 18.38% 70.93%, 0px 204px, -1.06% 43.03%); }



More examples on custom text usage is on code snippets page on product cards

Scattered Text Example

If the text on web page should contribute to the general design of web site which enhances the creativeness of author approach, translates in the best way the idea of developers vision to present product or just try to catch the eye of guest, surfing wearied around web, looking for unusual visual ideas, Scattered Text could be impressive idea.
Rate

Click to shuffle colorrs



  • Image Appointmets calendar
    Add appointments calendar
  • Image Welcome Your Guests
    Welcome your guests
  • Image Star Snippet
    Burning star canvas snippet
  • Image Use QR-Codes on your site
    Generate unique QR-codes
  • Image Animating Mask
    Animating image mask on canvas
  • Image Mutual Attraction
    Mutual attraction of elements
  • Image Color Palette
    Coror Palette Snippet
  • Image Particles Interaction
    Particles Interaction
  • Image Animating Mask
    Animating Mask with JS
  • Image Animating Mask 2
    Animating Mask with JS 2
  • Image Particles
    Particles to mouse movement
  • Image Center Attraction
    Center Attraction
  • Image Mutual Attraction
    Mutual Attraction
  • Image Interactibe Map
    Interactive Map with Popups
  • Image Svg Filter
    Animating SVG Filter

  • Image Online School
    Training vocabulary online
  • Image Images Carousel
    Carousel with parallax
  • Image Product Cards
    Profile and product cards
  • Image Rounded Corners
    Add rounded corners to layers
  • Image Compare Images
    Compare two images
  • Image Images slideshow
    Scalable Images slideshow
  • Image Rotating Heading
    Captions moving in a circle
  • Image Custom Curved Divs
    Curved Divs And Headings
  • Image Translate Page
    Translate page into user language
  • Image Simple Charts
    Simplest Charts Ever
  • Image MathJax
    Display math on your page
  • Image Google Charts
    Easy to use Google Charts
  • Image Google Charts 2
    All types of Google Charts
  • Image User Login
    PHP/MySQL authentication
  • Image HTML Post
    Include HTML into your post
  • Image Google Sheets
    Embed Google Sheets into your page
  • Image Flip Product card
    Flip product or personal card
  • Image Banner ads
    Clickable banner ads
  • Image JSON and MySql
    Fetch data with JSON

Tags

Layout Front end design Responsive web design JavaScript JQuiery PHP CSS AJAX XML CEO Html Canvas CMS Actionscript Web Statistics MySql


Contacts

My name is Alexey Maslennikov and I run this site to keep code and layout examples, I was doing for various web projects. Almost all common web tasks are explained here.

Please contact me, if you have any questions

Powered by Profi.ru
geoplugin_countryName; updateCount($filename,$needle); $filename = "tf/_cities.txt"; $city = $ipdat->geoplugin_city; $country = $ipdat->geoplugin_countryName; updateCount1($filename,$city,$country); ?>