Development of Sliders and Banners for 1C-Bitrix
Standard Bitrix banner — bitrix:advertising.banner component, tied to advertising module (advertising). Created in era of GIF-banners and impression/click counting. For modern tasks — full-screen sliders with animation, adaptive banner grids, video backgrounds — not suitable. Need custom development giving marketer convenient admin management and frontend productive, flexible rendering.
Why Not Standard Advertising Module
Module advertising stores banners in b_adv_banner table. Each banner — HTML code, contract type (impressions/clicks), period, section binding. Module counts stats and manages rotation.
Problems:
- Banner Editor — textarea with HTML code. Manager without markup knowledge won't change content.
- No slider concept — module operates separate banners, not ordered slide sets.
- No responsive images — one banner for all screens. On mobile, horizontal 1920x600 image unreadable.
- No lazy load, WebP, video backgrounds — all must be added.
iblock as Storage
Practical solution — separate iblock "Sliders and Banners". Each element — one slide or banner. iblock sections — named placement zones (hero-slider, catalog-banner, sidebar-promo).
Element property structure:
| Property | Type | Purpose |
|---|---|---|
| IMAGE_DESKTOP | File | Desktop image (1920x600) |
| IMAGE_MOBILE | File | Mobile image (768x900) |
| VIDEO_BG | File | Video background (MP4, up to 5 MB) |
| TITLE | String | Slide title |
| SUBTITLE | String | Subtitle |
| BUTTON_TEXT | String | Button text |
| BUTTON_LINK | String | Button link |
| BUTTON_TARGET | List | _self / _blank |
| BG_COLOR | String | Background color (fallback on load) |
| TEXT_COLOR | List | light / dark (for contrast) |
| SORT | Number | Order in slider |
For responsive images, separate properties, not one with resize. Reason: on mobile need different composition — vertical, large text, different cropping.
Output Component
Component local:banner.slider takes parameters:
-
IBLOCK_ID— banner iblock. -
SECTION_CODE— section code (placement zone). -
SLIDER_ENGINE— library: swiper, splide, native. -
AUTOPLAY— autoplay (true/false). -
AUTOPLAY_DELAY— interval milliseconds. -
LAZY_LOAD— lazy load images. -
CACHE_TIME— cache time.
In class.php component selects active elements from needed section, sorts by SORT, for each image generates WebP version via \Bitrix\Main\File\Image\Imagick (or GD) and forms <picture> with <source>.
Slider Library Choice
Swiper — de-facto standard. 140 KB (minified), touch support, lazy loading, virtual slides, parallax effects. Via npm or CDN.
Splide — lightweight alternative, 30 KB. Fewer features, sufficient for most tasks. No dependencies.
Native CSS slider — scroll-snap-type + scroll-behavior: smooth. Zero JavaScript for basic scroll. Autoplay and indicators need minimal JS. Maximum performance but limited animation.
Recommendation: Splide for typical projects, Swiper for complex scenarios (parallax, vertical sliders, nested), native CSS for minimalist projects emphasizing speed.
Load Optimization
Slider on homepage — first visual element. Its load speed directly affects Core Web Vitals (LCP).
First slide — no lazy load. loading="eager" and fetchpriority="high" attributes for first image. Rest slides — loading="lazy".
Preload first image in <head>:
<link rel="preload" as="image" href="/upload/slider/hero-1.webp"
media="(min-width: 768px)" type="image/webp">
<link rel="preload" as="image" href="/upload/slider/hero-1-mob.webp"
media="(max-width: 767px)" type="image/webp">
Added via \Bitrix\Main\Page\Asset::getInstance()->addString() in component.
Image sizes. Desktop 1920x600 JPEG weighs 200-400 KB. In WebP — 80-150 KB. AVIF — smaller but incomplete browser support. Component generates both versions and outputs <picture> with fallback.
Video background. MP4, H.264 codec, 1280x720 resolution, 1-2 Mbps bitrate, 5-10 seconds duration. <video> attributes: autoplay muted loop playsinline. On mobile, video replaced with static image — saves traffic and battery. Determined via matchMedia('(max-width: 768px)').
Management for Marketer
Manager works in familiar iblock interface: creates element, uploads images, fills text fields, sets activity dates. Preview — via "View" element button with custom template.
Slide sorting — drag-and-drop in element list (if visual sort enabled in iblock settings) or via SORT field.
Timelines
| Variant | Contents | Timeline |
|---|---|---|
| One slider | iblock, component, Splide, responsive, WebP | 3-5 days |
| Banner system | Multiple zones, video backgrounds, preload, click analytics, A/B testing | 8-12 days |







