ltsecurityinc安防产品在线商城代码
This commit is contained in:
+117
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Olegnax
|
||||
* @package Olegnax_HotSpotQuickview
|
||||
* @copyright Copyright (c) 2023 Olegnax (http://olegnax.com/). All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use Magento\Framework\Escaper;
|
||||
use Olegnax\HotSpotQuickview\Block\Widget\HotSpot;
|
||||
|
||||
/** @var HotSpot $block */
|
||||
/** @var Escaper $escaper */
|
||||
if ($block->isEnabled()):
|
||||
$mobileBreakpoint = 768;
|
||||
$widgetId = $block->getWidgetId();
|
||||
$hotspotHeight = $block->getHeight();
|
||||
$hotspotWidth = $escaper->escapeHtmlAttr($block->getWidth());
|
||||
$inlineStyles = $inlineStylesInner = $customStyles = $classes = [];
|
||||
$tooltipText = $block->getTooltipText();
|
||||
$iconClass = 'athlete2-icon-' . $block->getIcon();
|
||||
$iconStyle = ($block->getColor() != '') ? ('style="color: ' . $block->getColor() . '"') : '';
|
||||
if($block->getColorBackground()){
|
||||
$inlineStylesInner[] = 'background-color: ' . $block->getColorBackground() . ';';
|
||||
}
|
||||
if($block->getBorderRadius() != ''){
|
||||
$inlineStylesInner[] = 'border-radius: ' . $escaper->escapeHtmlAttr($block->getBorderRadius()) . 'px;';
|
||||
}
|
||||
if($hotspotHeight){
|
||||
$inlineStyles[] = 'height: ' . $escaper->escapeHtmlAttr($hotspotHeight) . 'px;';
|
||||
}
|
||||
if($hotspotWidth){
|
||||
$inlineStyles[] = 'min-width: ' . $hotspotWidth . 'px;';
|
||||
}
|
||||
$inlineStyles[] = 'left: ' . $escaper->escapeHtmlAttr($block->getPositionLeft()) . '%;';
|
||||
$inlineStyles[] = 'top: ' . $escaper->escapeHtmlAttr($block->getPositionTop()) . '%;';
|
||||
if($block->getBorderSize() > 0){
|
||||
$inlineStylesInner[] = 'border: ' . $escaper->escapeHtmlAttr($block->getBorderSize()) . 'px solid;';
|
||||
}
|
||||
if( $block->getBorderColor() ){
|
||||
$inlineStylesInner[] = 'border-color:' . $block->getBorderColor(). '; ';
|
||||
}
|
||||
|
||||
if($block->getHideMobile()){
|
||||
$classes[] = 'hide-on-mobile';
|
||||
}
|
||||
if($block->getMobileMinimized()){
|
||||
$classes[] = 'mobile-minimized';
|
||||
}
|
||||
$classes[] = $escaper->escapeHtmlAttr($block->getCustomClass());
|
||||
|
||||
if($block->getPulseAnimation()){
|
||||
$classes[] = '-pulse';
|
||||
if($block->getPulseAnimationColor()){
|
||||
$customStyles[] = '#' . $widgetId . '.ox-hotspot__item.-pulse:before{background-color:' . $block->getPulseAnimationColor() . '}';
|
||||
}
|
||||
}
|
||||
$tooltip_color = $block->getTooltipColor();
|
||||
$tooltip_color_background = $block->getTooltipColorBackground();
|
||||
$tooltip_width = $escaper->escapeHtmlAttr($block->getTooltipWidth());
|
||||
$mobileTop = $escaper->escapeHtmlAttr($block->getPositionTopM());
|
||||
$mobileLeft = $escaper->escapeHtmlAttr($block->getPositionLeftM());
|
||||
if($mobileLeft != ''){
|
||||
$customStyles[] = '@media (max-width: ' . $mobileBreakpoint . 'px){#' . $widgetId . '.ox-hotspot__item{left: ' . $mobileLeft . '%!important;}}';
|
||||
}
|
||||
if($mobileTop != ''){
|
||||
$customStyles[] = '@media (max-width: ' . $mobileBreakpoint . 'px){#' . $widgetId . '.ox-hotspot__item{top: ' . $mobileTop . '%!important;}}';
|
||||
}
|
||||
if( $hotspotWidth && (($block->getTooltipContent() && $block->getTooltipStatic() != '' ) || (!$block->getTooltipContent() && $tooltipText != ''))){
|
||||
$customStyles[] = '#' . $widgetId . ' .ox-hotspot__tooltip{left: ' . $hotspotWidth/2 . 'px;}';
|
||||
}
|
||||
|
||||
if($tooltip_width != ''){
|
||||
$customStyles[] = '#' . $widgetId . ' .ox-hotspot__tooltip{width: ' . $tooltip_width . 'px;}';
|
||||
}
|
||||
if($tooltip_color_background != ''){
|
||||
$customStyles[] = '#' . $widgetId . ' .ox-hotspot__tooltip{background-color: ' . $tooltip_color_background . ';}';
|
||||
}
|
||||
if($tooltip_color != ''){
|
||||
$customStyles[] = '#' . $widgetId . ' .ox-hotspot__tooltip{color: ' . $tooltip_color . ';}';
|
||||
}
|
||||
if ( !empty($customStyles) ){
|
||||
echo '<style>' . implode(' ', $customStyles) . '</style>';
|
||||
}
|
||||
if($block->getShadow()){
|
||||
$classes[] = '-shadow';
|
||||
}
|
||||
?>
|
||||
<div id="<?= $widgetId ?>"
|
||||
class="ox-hotspot__item ox-quickview-button <?php if ( !empty($classes) ){ echo implode(' ', $classes); } ?>"
|
||||
<?php if($block->getHref()) { ?>
|
||||
data-quickview-url="<?= $escaper->escapeUrl($block->getHref()) ?>"
|
||||
<?php } ?>
|
||||
<?php if ( !empty($inlineStyles) ){ echo 'style="' . implode(' ', $inlineStyles) . '"'; } ?> >
|
||||
<div class="inner" <?php if ( !empty($inlineStylesInner) ){ echo 'style="' . implode(' ', $inlineStylesInner) . '"';} ?>>
|
||||
<?php if ( $block->getIcon() ){ ?>
|
||||
<span class="ox-hotspot__icon <?= $iconClass ?>" <?= $iconStyle ?> > </span>
|
||||
<?php } ?>
|
||||
<?php $label_text = $escaper->escapeHtml($block->getLabelText()); ?>
|
||||
<?php if ( $label_text != '' ){ ?>
|
||||
<span class="-text hs" <?= $iconStyle ?>><?= $label_text ?></span>
|
||||
<?php } ?>
|
||||
<?php if ($block->getTooltipContent()){
|
||||
if ( $block->getTooltipStatic() != '' ){ ?>
|
||||
<div class="ox-hotspot__tooltip <?php if($block->getTooltipBoldText()) { echo '-text'; } ?>"><?= $block->getLayout()->createBlock( 'Magento\Cms\Block\Block' )->setBlockId( $block->getTooltipStatic() )->toHtml();?></div>
|
||||
<?php }
|
||||
} else {
|
||||
if($tooltipText != '') { ?>
|
||||
<div class="ox-hotspot__tooltip <?php if($block->getTooltipBoldText()) { echo '-text'; } ?>"><?= $tooltipText ?></div>
|
||||
<?php }
|
||||
}?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
unset($classes,$customStyles, $inlineStyles, $inlineStylesInner);
|
||||
endif;
|
||||
+167
@@ -0,0 +1,167 @@
|
||||
@ox-hotspot__size: 38px;
|
||||
@ox-hotspot-icon__size: 17px;
|
||||
@ox-hotspot-icon-smal__size: 10px;
|
||||
@ox-hotspot__tooltip-width: 190px;
|
||||
//
|
||||
// Common
|
||||
// _____________________________________________
|
||||
|
||||
& when (@media-common = true) {
|
||||
@keyframes hs_pulse {
|
||||
0% { transform:scale(1);opacity:0; }
|
||||
20% { opacity:0.6; }
|
||||
100% { transform:scale(3); opacity:0; }
|
||||
}
|
||||
.ox-hotspot__container{
|
||||
position:relative;
|
||||
> img{
|
||||
width:100%;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
.ox-hotspot__item{
|
||||
cursor:pointer;
|
||||
min-width: @ox-hotspot__size;
|
||||
height: @ox-hotspot__size;
|
||||
margin-top: -(@ox-hotspot__size/2);
|
||||
margin-left: -(@ox-hotspot__size/2);
|
||||
position: absolute;
|
||||
text-align: left;
|
||||
top:50%;
|
||||
left:50%;
|
||||
&.-shadow{
|
||||
.inner{
|
||||
box-shadow:0px 7px 16px 0 rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
}
|
||||
&.-pulse{
|
||||
&:before{
|
||||
position: absolute;
|
||||
display: block;
|
||||
width: @ox-hotspot__size;
|
||||
height: @ox-hotspot__size;
|
||||
-webkit-border-radius: 50%;
|
||||
-moz-border-radius: 50%;
|
||||
-ms-border-radius: 50%;
|
||||
border-radius: 50%;
|
||||
content: ' '!important;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
opacity: 0;
|
||||
margin-top: -@ox-hotspot__size/2;
|
||||
margin-left: -@ox-hotspot__size/2;
|
||||
background-color: currentColor;
|
||||
animation: hs_pulse 2s ease infinite;
|
||||
}
|
||||
}
|
||||
.inner{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
align-content: center;
|
||||
position: relative;
|
||||
border-radius: 40px;
|
||||
z-index: 1;
|
||||
}
|
||||
.-bold,
|
||||
.-text{
|
||||
line-height: 1;
|
||||
display: block;
|
||||
font-weight: @font-weight__bold;
|
||||
}
|
||||
.-upper{
|
||||
text-transform: uppercase;
|
||||
}
|
||||
&:hover{
|
||||
.ox-hotspot__tooltip{
|
||||
transition: all 0.3s ease;
|
||||
opacity:1;
|
||||
visibility:visible;
|
||||
top: -10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.ox-hotspot__tooltip{
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: @ox-hotspot__size/2;
|
||||
opacity:0;
|
||||
visibility:hidden;
|
||||
padding: 12px 18px;
|
||||
background: white;
|
||||
box-shadow: 0px 4px 20px 0px rgba(0, 0, 0, 0.12);
|
||||
width:@ox-hotspot__tooltip-width;
|
||||
transform: translateY(-100%) translateX(-50%);
|
||||
transition: all 0.15s ease;
|
||||
line-height:1.4;
|
||||
&:before{
|
||||
content: '';
|
||||
background: inherit;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
transform: rotate(45deg);
|
||||
display: block;
|
||||
position: absolute;
|
||||
bottom: -6px;
|
||||
left: ~"calc(50% - 6px)";
|
||||
z-index: -1;
|
||||
}
|
||||
}
|
||||
.ox-hotspot__icon{
|
||||
&.athlete2-icon-plus{
|
||||
position: relative;
|
||||
font-size: @ox-hotspot-icon__size;
|
||||
width: @ox-hotspot-icon__size;
|
||||
height: @ox-hotspot-icon__size;
|
||||
line-height: @ox-hotspot-icon__size;
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
}
|
||||
&.athlete2-icon-plus-small{
|
||||
position: relative;
|
||||
width: @ox-hotspot-icon-smal__size;
|
||||
height: @ox-hotspot-icon-smal__size;
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
&:after,
|
||||
&:before{
|
||||
content: '';
|
||||
background: currentColor;
|
||||
width: @ox-hotspot-icon-smal__size;
|
||||
height: 2px;
|
||||
top: 4px;
|
||||
display: block;
|
||||
position: absolute;
|
||||
}
|
||||
&:after{
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
}
|
||||
& + .-text.hs{
|
||||
margin-left:5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__s) {
|
||||
.ox-hotspot__item{
|
||||
&.mobile-minimized{
|
||||
width: 20px!important;
|
||||
height: 20px!important;
|
||||
min-width: 20px!important;
|
||||
margin-top: -10px!important;
|
||||
margin-left: -10px!important;
|
||||
.ox-hotspot__icon,
|
||||
.-text.hs{
|
||||
display:none!important;
|
||||
}
|
||||
.inner{
|
||||
border-radius:10px!important;
|
||||
}
|
||||
&:hover .ox-hotspot__tooltip{
|
||||
left: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user