Today I got familiar with the mouse zooming effect on the front end of Taobao, which is similar to the principle of using slides. I will analyze this code here. Copy code The code is as follows:<div class="sub all_t1" style="width:160px;height:107px;background:url(upload/2022/web/T2khnoXihaXXXXXXXX_!!845309971.png_160x160.jpg) no-repeat;"> <div data-widget-config="{'trigger':'.all_t1','align':{'node':'.all_t1','offset':[0,-160],'points':['bc','tc']}}" data-widget-type="Popup" class="J_TWidget hidden"> <div style="width:310px;height:207px;background:url(upload/2022/web/T2khnoXihaXXXXXXXX_!!845309971.png_310x310.jpg) no-repeat"></div> </div> </div> class="J_TWidget hidden" is the key to Taobao's built-in js code to control image attributes. It is used to obtain the node of the div and control the node. As for style, it is the definition of the style, including length, width, background image <div data-widget-config="{'trigger':'.all_t1','align':{'node':'.all_t1','offset':[0,-160],'points':['bc','tc']}}" data-widget-type="Popup" class="J_TWidget hidden"> This is undoubtedly the definition of the properties of the special effects. node: 'custom', // reference element. The popup is positioned relative to the reference element. Just like writing contacts, Supports writing of class and id selectors points: [tr,tl], // ['tl', 'tr'] means that the popup's tl is aligned with the reference node's tr. For the specific meaning and value of tl and tr, please see the screenshot below. t(top),c(center),b(bottom),l(left),r(right) offset: [0,0] // Valid value is [n, m], after points are aligned, offset value, Generally, it can be used for fine-tuning. n and m represent the alignment of two points. The offset between the x and y coordinates |
<<: Example of using negative margin to achieve average layout in CSS
>>: vsftpd virtual user based on MySql authentication
BMP is an image file format that is independent o...
Everyone must be familiar with table. We often en...
There are two types of dead link formats defined b...
Preface A Docker image consists of a Dockerfile a...
Table of contents question: There are 2 tokens in...
Simple example of adding and removing HTML nodes ...
A reader contacted me and asked why there were pr...
It is very important to monitor the operating sta...
Table of contents Overview Property settings Proc...
Effect html <body> <div class="cont...
Mac uses Shell (Terminal) SSH to connect to the r...
Recently, when I was using the Linux operating sy...
During the work development process, a requiremen...
Problem to be solved Mainly for cross-level commu...
OBS studio is cool, but JavaScript is cooler. Now...