What is an embedded web background. Responsive whole background image with CSS

Connecting the popular Zadarma service to 1C is now a matter of a few minutes. It is enough to connect a ready-made extension for the integration of 1C and Zadarma. Any employee can easily perform the installation, even the cleaning lady, Aunt Masha, a cleaning specialist.

First of all, we focused on small businesses that actively use the Zadarma PBX and the 1C configuration: Management of a small firm 1.6.

As it was before

To integrate with Zadarma, you needed to use a special dialer built into 1C - the so-called SIP background. This option was suitable when there were several "ifs":

  • if 1C is installed on a local computer, and not somewhere on a terminal server
  • if the user agrees to use a 1C dialer instead of a desk phone

In general, if all the “ifs” agreed, then the integration was possible.

How it became now

Now, for the integration of 1C and Zadarma, it does not matter at all which end device is used for calls. It can be anything:

  • desk phone
  • softphone installed in the OS
  • web background running in browser

The 1C extension for Zadarma interacts with the API, not the dialer. Therefore, it does not matter what exactly the user will call.

Easy to install

Installation consists of 1 step. Let's just show you 2 screenshots.

Placement on the home page

The Zadarma telephony panel automatically appears on the home page. If suddenly the user does not need this, then he can simply uncheck the box in the menu "View" - "Customize the start page".

Easy to set up

We take API keys from Zadarma personal account

and insert them into 1C

And of course, we enter the login / password of the account on simplit.io.

That's it, now your 1C is connected to Zadarma.

Calls on click in 1C

Wherever we see the "phone" icon, we can click on it and Zadarma will start dialing the number.

Requisites "Contact information" are in many lists of documents, reference books - you no longer need to run to the client's card to make a call. For example, you can call directly from the list of orders, invoices, consumables

Client card for an incoming call

A function that has actually become standard and mandatory when integrating 1C and PBX. Although it should be noted that it is not always in demand, so it can be turned off in the Telephony panel settings.

Call registration with Event document

Likewise, you can control the need for automatic creation of the "Event-Phone Call" document. Using this document, it is convenient to leave comments on the call.

And most importantly, on the basis of this document, you can then enter the Order, Invoice and thus the relationship between the call and the sale will be clearly visible.

You can attach a reminder to the Phone call document, which is very convenient if the employee promised to call the client back later.

PBX call history

Call history is, of course, a very important thing. The extension for the integration of 1C and Zadarma provides several options for working with history.

For example, a user wants to view a story by himself. Similar to the list of recent calls in our cell phone. This history can be viewed by opening the History tab on the home page.

Very often I want to see the history of a specific client, contact person or individual. In the case of a client, we need to see both calls to the numbers of the counterparty himself and to the numbers of all his contact persons.

The history of calls with selection by the client can be viewed directly in his card. The history includes calls from the client and all of his contacts. When the number belongs to the counterparty himself, the "Contact" field is not filled.

From the author: In this tutorial, we'll walk you through a simple technique for creating a background image that will fully stretch across the full width of the browser's viewport. For this we need the background-size CSS property; JavaScript is not needed.

Examples of responsive whole background images

Nowadays, it has become quite popular to use a huge photo as a background, which takes up an entire web page. Here are examples of several sites that have responsive whole background images set:

If you would like to achieve a similar result in your next web project, then this article is what you need.

Basic principles

Here's our plan of action.

Use the background-size property to completely fill the viewport

The background-size CSS property is set to cover. The cover value tells the browser to automatically and proportionally scale the width and height of the background image so that it is always equal to or greater than the width / height of the viewport.

Use a media query to handle small background images for mobile devices

To improve page loading speed on small screens, we'll use a media query to process a smaller version of our background image. It's not obligatory. This technique will work without it. But why is it a good idea to use a small background image for mobile devices?

The image I used in the demo is 5500x3600px. This resolution is sufficient for most widescreen computer monitors currently on the market. But for this you have to process a 1.7MB file.

Such a huge additional load just for the sake of placing a background photo will not do any good anyway. And, of course, this will be extremely bad for connections using the mobile Internet. And also such a resolution is unnecessary for devices with a small screen (more on this later). Let's take a look at the whole process.

Html

For the markup, you only need this:

We're going to assign a background image to the body element so that the image always fills the entire browser viewport.

However, this technique will also work for any block-level element (like a div or a form). If the width and height of your block element is fluid, then the background image will always be scaled to fill the entire container.

CSS

We set the following styles for the body element:

body (/ * Path to image * / background-image: url (images / background-photo.jpg); / * Background image is always centered vertically and horizontally * / background-position: center center; / * Background image does not repeat * / background-repeat: no-repeat; / * The background image is fixed in the viewport, so it does not shift when the content height is greater than the image height * / background-attachment: fixed; / * This is what allows the background image to adjust to the size of the container * / background-size: cover; / * Sets the background color to be displayed while the background image is loading * / background-color: # 464646;)

body (

/ * Path to image * /

background - image: url (images / background - photo.jpg);

/ * Background image is always centered vertically and horizontally * /

/ * Background image does not repeat * /

background - repeat: no - repeat;

/ * The background image is fixed in the viewport, so it does not shift when the content height is greater than the image height * /

/ * This is what allows the background image to adjust to the size of the container * /

background - size: cover;

/ * Sets the background color to be displayed while the background image is loading * /

background - color: # 464646;

The most important property / value pair to watch out for:

background-size: cover;

background - size: cover;

This is where the magic begins. This property / value pair tells the browser to scale the background image proportionally, i.e. so that its width and height are equal to or greater than the width / height of the element (in our case, this is the body element).

However, this property / value pair has one problem: if the background image is smaller than the body element - which will happen on high-resolution screens and / or when you have a huge amount of content on the page - the browser will inevitably zoom in on the image. And, as we know, when we increase the size of the bitmap, the image quality decreases (in other words, pixelation occurs).

Increasing the image size from its original size affects the image quality. Keep this in mind when choosing a suitable image. The demo uses a huge 5500x3600px photo for widescreen monitors, so it will take a very large screen for quality distortion to occur. Let's move on. To keep the background image in the center of the viewport, we add:

background-position: center center;

background - position: center center;

This entry places the background on the coordinate axis in the center of the viewport. Next, we need to define what happens when the content height exceeds the visible height of the viewport. When this happens, a scroll bar appears.

In this case, we need to make sure that the background image stays in its original position even when the user scrolls down the page. In this situation, the image will either just end on scrolling, or it will move as it scrolls (which can be very distracting for the user). To fix the background, we set the background-attachment property to fixed.

background-attachment: fixed;

background - attachment: fixed;

In the demo, I added the "load content" feature so you can see what happens when the scrollbar appears in the browser when the background-attachment property is set to fixed. You can also download the demo and play with the positioning property values ​​(such as background-attachment and background-position) to see how this affects page scrolling and background image. The rest of the property values ​​are pretty self-explanatory.

Shorthand CSS

I have detailed the background properties to make them easier to explain. The abbreviated notation will also be equivalent:

body (background: url (background-photo.jpg) center center cover no-repeat fixed;)

body (

background: url (background - photo.jpg) center center cover no - repeat fixed;

All you need to do is change the url value to point to the path to your background image.

Optional: media query for small screens

For small screens, I used Photoshop to scale down the original background image proportionally to 768x505px, and I also used Smush.it to reduce the size a little more. This reduced the file size from 1741KB to 114KB. Those. image size reduced by 93%.

Please don't get me wrong, 114KB is still quite a lot for a purely aesthetic design element. Given the additional 114KB overhead, I would only use such a file if I saw an opportunity to significantly improve the user experience (UX). at the moment a significant proportion of Internet traffic comes from mobile devices background - image: url (images / background - photo - mobile - devices. jpg);

The media query has a max-width: 767px width limit, which means that if the browser viewport is larger than 767px, a large background image will load.

The disadvantage of using this media query is that if you change the width of your browser window, for example, from 1200px to 640px (or vice versa), you will immediately see the moment a small or large background image loads.

In addition, due to the fact that some devices with a small screen can display more pixels - for example, the iPhone 5 with a retina display is capable of displaying a resolution of 1136x640px - the small background image will be pixelated.

Summarizing

You can view a more up-to-date version of the source code from this tutorial on GitHub. I can only warn you about one thing: please use this technique with caution, because large files can seriously damage the UX, especially if the end user is using a slow and unreliable Internet connection. This is another reason why you should choose an appropriate background color so that the user can read the content while the background image is loading.

Large videos in the background of websites are a pretty popular trend in web design. Cleverly applied videos can make a website more dramatic and engaging to users.

In addition, video backgrounds can be played smoothly and without "brakes", unlike backgrounds created with JavaScript, which require loading certain code and images before the user sees the result of the animation.

There are companies like Powerhouse or Adidas that use video as the background of a website to convey a specific message or story about a product or service to the user.

Although the most popular way to create a video background is using HTML5 video tag along with some CSS parameters, you should also pay attention to alternative video sources, for example, YouTube. In this case, you do not have to worry about the slow response of the server, because the request will be sent directly to YouTube.

In this article, I'll show you how you can build a cool website that uses YouTube videos as a background. We will be using jQuery.mb.YTPlayer.js to edit and control the look of our video. So let's get started!

Download sources
Demo

You will need:

// Big Background Content here

// About Section Content here // Small Background Section Content here

Now you need to fill each section with content. In the big-background and small-background-section, place the class pattern, to create a light texture in our video. You also need to add h1, h2, paragraph and button.

YOUTUBE

BACKGROUND VIDEO

I want to learn this

Put any YouTube video in the background of the site

Wondering how to add video to the background of your website?
It's as easy as shelling pears! With jQuery MB.YTPlayer, a jQuery plugin, you can embed any YouTube video into the background of your site.
You can easily turn any video into an HTML background. No delays in page load and server load!

Download plugin now

We are from social networks


I used the font Font Awesome for the social icons, which are located in the section small-background-section... Then we will add a template for our video using the plugin jQuery.mb.YTPlayer. Place the following code right after .

Here's what we used to customize the video:

  • class player- this class is used by the plugin mb.YTPlayer
  • videoURL- link to video
  • containment- CSS selector in which to play the video
  • autoPlay- auto-play video
  • mute- the presence of sound
  • startAt- the time from which to start playing the video
  • opacity- video transparency

CSS

Let's add styles to our site. First of all, let's define the appearance of the html, body, paragraph tags and bulleted list.

Html (height: 100%) body (font: 15px / 23px "Raleway", sans-serif; margin: 0; padding: 0; height: 100%; width: 100%; -webkit-font-smoothing: antialiased; - webkit-text-size-adjust: 100%) p (font-size: 20px; line-height: 140%; text-align: center) ul li (display: inline-block; list-style: none; padding-right : 10px;)

Wrapper (z-index: 600; position: relative) .pattern (background-image: url (../ images / pattern.png); background-repeat: repeat; background-attachment: scroll; width: 100%; height: 100%; position: absolute; top: 0; left: 0) .divider (background-image: url (../ images / divider.png); display: block; width: 300px; height: 35px; margin: 10px auto ) #colorize (color: # f1c40f; font-family: "Lato", sans-serif; font-size: 40px)

It's time to style the big-background section. Install z-index on 550 and parameter overflow to hidden. This is to prevent YouTube content (subtitles, annotations) from being displayed on our website. The rest of the styles are needed for the headers, buttons, and the default image (more on that later).

Big-background (z-index: 550; text-align: center; height: 100%; min-height: 100%; position: relative; overflow: hidden) .big-background .big-background-container (width: 830px ; max-width: 100%; display: inline-block; position: absolute; top: 50%; left: 50%; -webkit-transform: translate (-50%, - 50%); -moz-transform: translate (-50%, - 50%); -ms-transform: translate (-50%, - 50%); -o-transform: translate (-50%, - 50%); transform: translate (-50%, -50%)) .big-background-title (font-family: "Raleway", sans-serif; font-size: 78px; color: #fff; font-weight: 300; text-transform: uppercase; text-align : center; margin-bottom: 22px; padding-top: 20px; display: inline-block; background-attachment: scroll; background-repeat: repeat-x; background-position: top center) a.big-background-btn ( font-family: "Lato", sans-serif; font-size: 13px; text-transform: uppercase; text-decoration: none; color: #fff; background: transparent; border: 2px solid #fff; padding: 10px 14px ; cursor: pointer; letter-spacing: 2px; text-align: center; display: inline-block; -webkit-transition: .4s background ease; -moz-transition: .4s background ease; -o-transition: .4s background ease; transition: .4s background ease; ) .big-background-btn: hover (color: #fff; background: rgba (255,255,255,0.20)) .big-background-default-image (background: url (../ images / sunset.jpg); background-repeat : no-repeat; background-position: center center; background-size: cover; width: 100%; height: 100%; z-index: 0; backface-visibility: hidden)

Now let's move on to the section about-section... Let's configure the parameter background-color to white and padding 60px top and bottom and 20px left and right.

About-section (font-family: "Lato", sans-serif; color: # 7f8c8d; background: #fff; padding: 60px 20px) .about-section-container (text-align: center; padding-bottom: 50px) .about-section-title (font-family: "Raleway", sans-serif; font-size: 40px; background: #fff; color: # 3d566e; padding: 0 35px; margin-bottom: 22px; background-attachment: scroll; background-repeat: repeat-x; background-position: center center; text-transform: uppercase) a.about-section-btn (font-family: "Lato", sans-serif; font-size: 13px; text -transform: uppercase; text-decoration: none; color: # 34495e; background: transparent; border: 2px solid # 34495e; padding: 10px 14px; cursor: pointer; letter-spacing: 2px; text-align: center; display: inline-block; -webkit-transition: .4s background ease; -moz-transition: .4s background ease; -o-transition: .4s background ease; transition: .4s background ease;) .about-section-btn: hover (color: #fff; background: # 34495e;)

For the small-background-section, which also serves as a footer, we'll assign a width of 100% and a parameter overflow to hidden. We'll also add some padding top and bottom so that our video can be seen. Finally, let's add styles for the social media buttons.

Small-background-section (font-family: "Raleway", sans-serif; padding: 100px 0; position: relative; width: 100%; overflow: hidden) .small-background-container (position: relative; text-align : center) .small-background-title (font-size: 40px; color: # f1c40f; font-weight: 300; z-index: 10; display: inline-block; text-transform: uppercase; margin-bottom: 20px ; margin-top: 20px; position: relative; background-attachment: scroll; background-repeat: repeat-x; background-position: top center) .socials a (color: #fff) .socials a: hover (color: # bdc3c7)

Media queries

To make our site responsive, let's add some media queries.

@media screen and (max-width: 768px) (.about-section-title (line-height: 1)) @media screen and (max-width: 480px) (.big-background-title (font-size: 58px ) .small-background-title (line-height: 1) / *. player (display: none;) -> If you want to remove the video bg on a specific viewport w / o plugin * /) @media screen and ( max-width: 360px) (.big-background-title, # colorize (line-height: 1)) @media screen and (max-width: 320px) (.small-background-title (font-size: 30px))

jQuery

Now let's turn on our YouTube video. Let's call the class player inside jQuery code. Place the following code before the closing body tag and inside the tags .
$ (function () ($ (". player"). mb_YTPlayer ();));

Fallback option

Background videos from YouTube will not play on mobile devices or tablets as YouTube policies do not allow it.

However, we can use jQuery to add a default background image in case the browser detects that the user has entered the site from a mobile device.

Manual solution

To determine that the user is logged in from a mobile device or tablet, we can hide the element on a specific screen size. For example, we want to remove the video background on 480px wide screens. You just need to add display: none to the player element:

@media screen and (max-width: 480px) (.player (display: none;))

As far as jQuery is concerned, here we will set a variable is_mobile with the parameter false. Then, make sure that the class player has display: none parameters. If so, then add the class big-background-default-image to sections big-background and small-background-section to use the default background image. Otherwise, nothing will change.

(function ($) ($ (document) .ready (function () (var is_mobile = false; if ($ (". player"). css ("display") == "none") (is_mobile = true;) if (is_mobile == true) (// Conditional script here $ (". big-background, .small-background-section"). addClass ("big-background-default-image");) else ($ (". player "). mb_YTPlayer ();)));)) (jQuery);

Solution with jQuery plugin

Another way to set the default image is with the jQuery plugin device.js(http://matthewhudson.me/projects/device.js/). This will simplify the process of describing conditions for different screen sizes of mobile devices. Using this plugin, we can simply write the following code:

(function ($) ($ (document) .ready (function () (//Device.js will check if it is Tablet or Mobile - http://matthewhudson.me/projects/device.js/ if (! device. tablet () &&! device.mobile ()) ($ (". player"). mb_YTPlayer ();) else (// jQuery will add the default background to the preferred class $ (". big-background, .small- background-section "). addClass (" big-background-default-image ");)));)) (jQuery);

Here I have used the methods device.mobile () and device.tablet () to check the device from which the user is logged in. If the condition is met that the class is added big-background-default-image to section big-background and small-background-section... Otherwise the class player will remain unchanged and the video will play.

We put in order

Videos are a great way to get your message across to your audience. It can be a powerful tool for your site if used correctly.

I am sure that as web design develops and improves, there will be more and more creative ideas for using video in website design. I hope you learned a thing or two in this tutorial. Write your thoughts and comments in the comments.

From a translator. With all wishes and comments regarding the translation, please contact me in a personal. Thanks!