You may have images in your website that are rich in intricate details — such as product photos or artwork. By using some custom code, you can enable your visitors to hover over and amplify specific parts of these images — all without having to move a muscle.
This tutorial will guide you through the process of enlarging your images by inserting custom code into a page or a project by following these steps:
- Insert the custom code
- Assign a class name
- Customize the magnifier
Insert the custom code
There are two methods to insert the custom code into your project:
- Include the code in the entire project
- Integrate the code in an individual page
To insert the code into your entire project:
- Access your project’s 設定
- 選擇 自訂程式碼 標籤
- Insert the code into the 頁尾碼 section (e.g., “Before </body> tag”)
- 點選 儲存變更
筆記: You can insert the code into your project using hotkeys 指令+V (在 Mac 上)或 控制+V (在 Windows 上)。
To insert the code into an individual page:
- 啟動 設計師
- 訪問 頁面面板 and select the page settings cog icon of the desired page
- 捲動到 自訂程式碼 section within the page settings
- Insert the code into the 前 </body> 標籤 部分
- 點選 節省
筆記: You can paste the code into your project using hotkeys 指令+V (在 Mac 上)或 控制+V (在 Windows 上)。
You have successfully integrated the custom code into your project!
Assign a class name
Let’s assign a unique class name to the images that we want to apply the magnification effect to:
- 選擇 影像 you wish to magnify
- 訪問 風格面板 並點擊 選擇器字段
- Give it a 班級 (e.g., “Magnify”)
Let’s include the “Magnify” class in our code:
- 訪問 頁面面板 and select the page settings cog icon of the page where your custom magnifier code is placed
- 捲動到 前 </body> 標籤 section in your page’s settings
- Replace “.影像” with your class name (e.g., “.magnify”)
- 點選 節省