Advertisement
Guest User

banner video shopify

a guest
Apr 8th, 2023
61,561
1
Never
4
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 9.37 KB | None | 1 0
  1. {%- if section.blocks.size > 0 -%}
  2.  
  3. {%- for block in section.blocks -%}
  4.  
  5. {%- assign img_url = block.settings.image | img_url: '1x1' | replace: '_1x1.', '_{width}x.' -%}
  6.  
  7.  
  8.  
  9. {% if block.type == 'video' %}
  10.  
  11. <div class="videoBox" style="{%- if block.settings.video_link == blank -%}background-image: url('{{ block.settings.video_image  | img_url: 'master' }}');{%- endif -%}">
  12.  
  13.  
  14.  
  15. {%- if block.settings.video_link != blank -%}
  16.  
  17. <div class="fullscreen-video-wrap">
  18.  
  19. <video class="video-js" loop autoplay preload="none" muted playsinline
  20.  
  21. poster="https:{{ block.settings.video_image | img_url: 'master' }}">
  22.  
  23. <source src="{{ block.settings.video_link }}" type="video/mp4">
  24.  
  25. </video>
  26.  
  27. </div>
  28.  
  29. {% endif %}
  30.  
  31.  
  32.  
  33.  
  34. <div class="videoBoxInfo">
  35.  
  36. {% if block.settings.title != blank %}
  37.  
  38. <h1 class="videoBoxInfoTitle" style="color: {{ block.settings.color_text }}">
  39.  
  40. {{ block.settings.title | escape }}
  41.  
  42. </h1>
  43.  
  44. {% endif %}
  45.  
  46.  
  47.  
  48. {%- style -%}
  49.  
  50. .videoBackground .imageBoxInfoDescription p {
  51.  
  52. color: {{ block.settings.color_text }}!important;
  53.  
  54. }
  55.  
  56. {%- endstyle -%}
  57.  
  58.  
  59.  
  60. {% if block.settings.text != blank %}
  61.  
  62. <div class="imageBoxInfoDescription" id="{{ block.id }}" style="color: {{ block.settings.color_text }}">
  63.  
  64. {{ block.settings.text }}
  65.  
  66. </div>
  67.  
  68. {% endif %}
  69.  
  70.  
  71.  
  72. {% if block.settings.button_link != blank and block.settings.button_label != blank %}
  73.  
  74. <a href="{{ block.settings.button_link }}" class="videoBoxInfoBtn" style="color: {{ block.settings.color_btn_text }}; background: {{ block.settings.color_btn_bg }}">
  75.  
  76. {{ block.settings.button_label | escape }}
  77.  
  78. </a>
  79.  
  80. {% endif %}
  81.  
  82. </div>
  83.  
  84. </div>
  85.  
  86. {% else %}
  87.  
  88. <div class="imageBox" style="background-color: {{ block.settings.color_bg }}; {%- if block.settings.image_bg != blank -%}background-image: url('{{ block.settings.image_bg | img_url: 'master' }}');{%- endif -%}">
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95. <div class="imageBoxInfo">
  96.  
  97. {% if block.settings.title != blank %}
  98.  
  99. <h1 class="imageBoxInfoTitle" style="color: {{ block.settings.color_text }}">
  100.  
  101. {{ block.settings.title | escape }}
  102.  
  103. </h1>
  104.  
  105. {% endif %}
  106.  
  107.  
  108.  
  109. {%- style -%}
  110.  
  111. .videoBackground .imageBoxInfoDescription p {
  112.  
  113. color: {{ block.settings.color_text }}!important;
  114.  
  115. }
  116.  
  117. {%- endstyle -%}
  118.  
  119.  
  120.  
  121. {% if block.settings.text != blank %}
  122.  
  123. <div class="imageBoxInfoDescription" id="{{ block.id }}" style="color: {{ block.settings.color_text }}">
  124.  
  125. {{ block.settings.text }}
  126.  
  127. </div>
  128.  
  129. {% endif %}
  130.  
  131.  
  132.  
  133. {% if block.settings.button_link != blank and block.settings.button_label != blank %}
  134.  
  135. <a href="{{ block.settings.button_link }}" class="imageBoxInfoBtn" style="color: {{ block.settings.color_btn_text }}; background: {{ block.settings.color_btn_bg }}">
  136.  
  137. {{ block.settings.button_label | escape }}
  138.  
  139. </a>
  140.  
  141. {% endif %}
  142.  
  143. </div>
  144.  
  145. </div>
  146.  
  147. {% endif %}
  148.  
  149. {%- endfor -%}
  150.  
  151.  
  152.  
  153. {% else %}
  154.  
  155. <div class="placeholderNoblocks">
  156.  
  157. This section doesn’t currently include any content. Add content to this section using the sidebar.
  158.  
  159.     </div>
  160.  
  161. {%- endif -%}
  162.  
  163.  
  164.  
  165. <style>
  166.  
  167. .main-content .videoBackground {
  168.  
  169. margin-top: -55px;
  170.  
  171. }
  172.  
  173. .videoBackground {
  174.  
  175. position: relative;
  176.  
  177. }
  178.  
  179. .videoBackground .fullscreen-video-wrap {
  180.  
  181. position: absolute;
  182.  
  183. top: 0;
  184.  
  185. left: 0;
  186.  
  187. min-width: 100%;
  188.  
  189. width: 100%;
  190.  
  191. height: 100%;
  192.  
  193. overflow: hidden;
  194.  
  195. }
  196.  
  197. .videoBackground .fullscreen-video-wrap .video-js {
  198.  
  199. position: absolute;
  200.  
  201. top: 0;
  202.  
  203. left: 0;
  204.  
  205. min-height: 100%;
  206.  
  207. min-width: 100%;
  208.  
  209. width: 100%;
  210.  
  211. height: 100%;
  212.  
  213. object-fit: cover;
  214.  
  215. }
  216.  
  217. .videoBackground .fullscreen-video-wrap video {
  218.  
  219. min-height: 100%;
  220.  
  221. min-width: 100%;
  222.  
  223. object-fit: cover;
  224.  
  225. }
  226.  
  227. .videoBackground .videoBox {
  228.  
  229. display: flex;
  230.  
  231. align-items: center;
  232.  
  233. justify-content: flex-end;
  234.  
  235. flex-direction: column;
  236.  
  237. padding: 100px 20px 80px;
  238.  
  239. background-size: cover;
  240.  
  241. background-position: center;
  242.  
  243. background-repeat: no-repeat;
  244.  
  245. min-height: 500px;
  246.  
  247. max-height: 800px;
  248.  
  249.         height: calc(100vh - 165px);
  250.  
  251. position: relative;
  252.  
  253. }
  254.  
  255. .videoBackground .imageBox {
  256.  
  257. display: flex;
  258.  
  259. align-items: center;
  260.  
  261. justify-content: flex-end;
  262.  
  263. flex-direction: column;
  264.  
  265. padding: 100px 20px 80px;
  266.  
  267. background-size: cover;
  268.  
  269. background-position: center;
  270.  
  271. background-repeat: no-repeat;
  272.  
  273. position: relative;
  274.  
  275. min-height: calc(100vh - 165px);
  276.  
  277. height: auto;
  278.  
  279. }
  280.  
  281. .videoBackground .videoBoxInfo, .videoBackground .imageBoxInfo {
  282.  
  283. z-index: 2;
  284.  
  285. margin: auto;
  286.  
  287. text-align: center;
  288.  
  289. }
  290.  
  291. .videoBackground .overlay {
  292.  
  293. content: "";
  294.  
  295. position: absolute;
  296.  
  297. top: 0;
  298.  
  299. right: 0;
  300.  
  301. bottom: 0;
  302.  
  303. left: 0;
  304.  
  305. background: #000;
  306.  
  307. z-index: 1;
  308.  
  309. }
  310.  
  311. .videoBackground .videoBoxInfoBtn, .videoBackground .imageBoxInfoBtn {
  312.  
  313. -moz-user-select: none;
  314.  
  315. -ms-user-select: none;
  316.  
  317. -webkit-user-select: none;
  318.  
  319. user-select: none;
  320.  
  321. -webkit-appearance: none;
  322.  
  323. -moz-appearance: none;
  324.  
  325. appearance: none;
  326.  
  327. display: inline-block;
  328.  
  329. width: auto;
  330.  
  331. text-decoration: none;
  332.  
  333. text-align: center;
  334.  
  335. vertical-align: middle;
  336.  
  337. cursor: pointer;
  338.  
  339. border: 1px solid transparent;
  340.  
  341. border-radius: 2px;
  342.  
  343. padding: 10px 30px;
  344.  
  345. font-style: normal;
  346.  
  347. font-weight: normal;
  348.  
  349. letter-spacing: 0.06em;
  350.  
  351. white-space: normal;
  352.  
  353. font-size: 16px;
  354.  
  355. margin-top: 20px;
  356.  
  357. }
  358.  
  359. .videoBackground .videoBoxInfoTitle, .videoBackground .imageBoxInfoTitle {
  360.  
  361. color: #FFF;
  362.  
  363. font-size: 65px;
  364.  
  365. line-height: 40px;
  366.  
  367. }
  368.  
  369. .videoBackground .videoBoxInfoDescription, .videoBackground .imageBoxInfoDescription {
  370.  
  371. max-width: 500px;
  372.  
  373. margin: 0 auto;
  374.  
  375. }
  376.  
  377. .videoBackground .videoBoxInfoDescription p, .videoBackground .imageBoxInfoDescription p {
  378.  
  379. font-size: 17px;
  380.  
  381. line-height: 28px;
  382.  
  383. }
  384.  
  385. .videoBackground .placeholderNoblocks {
  386.  
  387. text-align: center;
  388.  
  389. max-width: 500px;
  390.  
  391. margin: 0 auto;
  392.  
  393. }
  394.  
  395.     @media screen and (max-width: 767px) {
  396.  
  397. .main-content .videoBackground {
  398.  
  399. margin-top: -35px;
  400.  
  401. }
  402.  
  403. .videoBackground .fullscreen-video-wrap {
  404.  
  405. z-index: 3;
  406.  
  407. }
  408.  
  409. .videoBackground .videoBox {
  410.  
  411. min-height: 300px;
  412.  
  413. height: 100%;
  414.  
  415. position: relative;
  416.  
  417. padding: 0;
  418.  
  419. }
  420.  
  421. .videoBackground .fullscreen-video-wrap {
  422.  
  423. position: relative;
  424.  
  425. min-height: 300px;
  426.  
  427. z-index: -2;
  428.  
  429. }
  430.  
  431. .videoBackground .videoBoxInfo {
  432.  
  433. padding: 2px 20px;
  434.  
  435. width: 100%;
  436.  
  437. }
  438.  
  439. .videoBoxInfoTitle, .videoBackground .videoBoxInfoBtn {
  440. display: none;
  441.  
  442. }
  443.  
  444.     }
  445.  
  446. </style>
  447.  
  448.  
  449.  
  450. {% schema %}
  451.  
  452. {
  453.  
  454. "name": {
  455.  
  456. "en": "Video Background"
  457.  
  458. },
  459.  
  460. "class": "videoBackground",
  461.  
  462. "max_blocks": 1,
  463.  
  464. "blocks": [
  465.  
  466. {
  467.  
  468. "type": "video",
  469.  
  470. "name": "Video",
  471.  
  472. "settings": [
  473.  
  474. {
  475.  
  476. "type": "url",
  477.  
  478. "id": "video_link",
  479.  
  480. "label": {
  481.  
  482. "en": "Video link"
  483.  
  484. }
  485.  
  486. },
  487.  
  488. {
  489.  
  490. "type": "image_picker",
  491.  
  492. "id": "video_image",
  493.  
  494. "label": {
  495.  
  496. "en": "Cover image"
  497.  
  498. }
  499.  
  500. },
  501.  
  502. {
  503.  
  504.  
  505. "type": "header",
  506.  
  507. "content": {
  508.  
  509. "en": "Text"
  510.  
  511. }
  512.  
  513. },
  514.  
  515. {
  516.  
  517. "type": "text",
  518.  
  519. "id": "title",
  520.  
  521. "label": {
  522.  
  523. "en": "Heading"
  524.  
  525. },
  526.  
  527. "default": "Video slide"
  528.  
  529. },
  530.  
  531. {
  532.  
  533. "type": "richtext",
  534.  
  535. "id": "text",
  536.  
  537. "label": {
  538.  
  539. "en": "Description"
  540.  
  541. },
  542.  
  543. "default": {
  544.  
  545. "en": "<p>Use this text to share information about your brand with your customers. Describe a product, share announcements, or welcome customers to your store.</p>"
  546.  
  547. }
  548.  
  549. },
  550.  
  551. {
  552.  
  553. "type": "color",
  554.  
  555. "id": "color_text",
  556.  
  557. "label": {
  558.  
  559. "en": "Text color"
  560.  
  561. },
  562.  
  563. "default": "#ffffff"
  564.  
  565. },
  566.  
  567. {
  568.  
  569. "type": "text",
  570.  
  571. "id": "button_label",
  572.  
  573. "label": {
  574.  
  575. "en": "Button label"
  576.  
  577. }
  578.  
  579. },
  580.  
  581. {
  582.  
  583. "type": "url",
  584.  
  585. "id": "button_link",
  586.  
  587. "label": {
  588.  
  589. "en": "Button link"
  590.  
  591. }
  592.  
  593. },
  594.  
  595. {
  596.  
  597. "type": "color",
  598.  
  599. "id": "color_btn_bg",
  600.  
  601. "label": {
  602.  
  603. "en": "Background button color"
  604.  
  605. },
  606.  
  607. "default": "#ffffff"
  608.  
  609. },
  610.  
  611. {
  612.  
  613. "type": "color",
  614.  
  615. "id": "color_btn_text",
  616.  
  617. "label": {
  618.  
  619. "en": "Button text color"
  620.  
  621. },
  622.  
  623. "default": "#ffffff"
  624.  
  625. }
  626.  
  627. ]
  628.  
  629. },
  630.  
  631. {
  632.  
  633. "type": "image",
  634.  
  635. "name": "Image",
  636.  
  637. "settings": [
  638.  
  639. {
  640.  
  641. "type": "color",
  642.  
  643. "id": "color_bg",
  644.  
  645. "label": {
  646.  
  647. "en": "Background color (optional)"
  648.  
  649. },
  650.  
  651. "default": "#16165b"
  652.  
  653. },
  654.  
  655. {
  656.  
  657. "type": "image_picker",
  658.  
  659. "id": "image_bg",
  660.  
  661. "label": {
  662.  
  663. "en": "or use an image (required)"
  664.  
  665. }
  666.  
  667. },
  668.  
  669. {
  670.  
  671. "type": "range",
  672.  
  673. "id": "overlay_opacity",
  674.  
  675. "label": {
  676.  
  677. "en": "Overlay opacity"
  678.  
  679. },
  680.  
  681. "min": 0,
  682.  
  683. "max": 99,
  684.  
  685. "step": 1,
  686.  
  687. "unit": {
  688.  
  689. "en": "%"
  690.  
  691. },
  692.  
  693. "default": 0
  694.  
  695. },
  696.  
  697. {
  698.  
  699. "type": "header",
  700.  
  701. "content": {
  702.  
  703. "en": "Text"
  704.  
  705. }
  706.  
  707. },
  708.  
  709. {
  710.  
  711. "type": "text",
  712.  
  713. "id": "title",
  714.  
  715. "default": "Image slide",
  716.  
  717. "label": {
  718.  
  719. "en": "Heading"
  720.  
  721. }
  722.  
  723. },
  724.  
  725. {
  726.  
  727. "type": "richtext",
  728.  
  729. "id": "text",
  730.  
  731. "label": {
  732.  
  733. "en": "Description"
  734.  
  735. },
  736.  
  737. "default": {
  738.  
  739. "en": "<p>Use this text to share information about your brand with your customers. Describe a product, share announcements, or welcome customers to your store.</p>"
  740.  
  741. }
  742.  
  743. },
  744.  
  745. {
  746.  
  747. "type": "color",
  748.  
  749. "id": "color_text",
  750.  
  751. "label": {
  752.  
  753. "en": "Text color"
  754.  
  755. },
  756.  
  757. "default": "#ffffff"
  758.  
  759. },
  760.  
  761. {
  762.  
  763. "type": "text",
  764.  
  765. "id": "button_label",
  766.  
  767. "label": {
  768.  
  769. "en": "Button label"
  770.  
  771. }
  772.  
  773. },
  774.  
  775. {
  776.  
  777. "type": "url",
  778.  
  779. "id": "button_link",
  780.  
  781. "label": {
  782.  
  783. "en": "Button link"
  784.  
  785. }
  786.  
  787. },
  788.  
  789. {
  790.  
  791. "type": "color",
  792.  
  793. "id": "color_btn_bg",
  794.  
  795. "label": {
  796.  
  797. "en": "Background button color"
  798.  
  799. },
  800.  
  801. "default": "#ffffff"
  802.  
  803. },
  804.  
  805. {
  806.  
  807. "type": "color",
  808.  
  809. "id": "color_btn_text",
  810.  
  811. "label": {
  812.  
  813. "en": "Button text color"
  814.  
  815. },
  816.  
  817. "default": "#ffffff"
  818.  
  819. }
  820.  
  821. ]
  822.  
  823. }
  824.  
  825. ],
  826.  
  827. "presets": [
  828.  
  829. {
  830.  
  831. "name": {
  832.  
  833. "en": "Video Background"
  834.  
  835. },
  836.  
  837. "category": {
  838.  
  839. "en": "Main"
  840.  
  841. },
  842.  
  843. "blocks": [
  844.  
  845. {
  846.  
  847. "type": "video"
  848.  
  849. }
  850.  
  851. ]
  852.  
  853. }
  854.  
  855. ]
  856.  
  857. }
  858.  
  859. {% endschema %}
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement