首页 > 代码库 > LEADTOOLS HTML5&Javascript 入门笔记

LEADTOOLS HTML5&Javascript 入门笔记

TODO:待编辑

将HTML5 / JavaScript查看器控件添加到HTML文档

<head><script type="text/javascript">run: function SiteLibrary_DefaultPage$run() {// Create the viewervar createOptions = newLeadtools.Controls.ImageViewerCreateOptions(‘imageViewerDiv‘, ‘myViewer‘);_viewer = new Leadtools.Controls.ImageViewer(createOptions);// Set the image URL - load using browswer support_viewer.set_imageUrl("http://demo.leadtools.com/images/jpeg/cactus.jpg");},</script></head><body><div id="imageViewerDiv" /></body>

添加一些事件处理程序

var buttonPanZoom = document.getElementById(‘buttonPanZoom‘);buttonPanZoom.addEventListener(‘click‘, function (e) {// Set the interactive mode to PanZoomvar interactiveModePanZoom = newLeadtools.Controls.ImageViewerPanZoomInteractiveMode();_viewer.set_defaultInteractiveMode(interactiveModePanZoom);}, false);var buttonMagnify = document.getElementById(‘buttonMagnify‘);buttonMagnify.addEventListener(‘click‘, function (e) {// Set the interactive mode to MagnifyingGlassvar interactiveModeMagGlass = new Leadtools.Controls.ImageViewerMagnifyGlassInteractiveMode();interactiveModeMagGlass.set_borderThickness(5);_viewer.set_defaultInteractiveMode(interactiveModeMagGlass);}, false);