Mungkin teman-teman sering melihat ya, jika mengunjungi situs-situs eccomerce di bagian view gambar bisa melihat dengan detail dengan hanya menggeser pointer udar besar samabar tersebut, mungkin teman-teman bertanya-tanya dalam hati di buat menggunakan apa ya? setelah anda memuka blog saya maka terjawablah sudah semua pertanyaan yang ada di pikiran anda. yang nantinya akan seperti gambar di bawah ini.
Ikutin petunjuk yang saya bagikan.
1. Tarik jquery.min.js, xzoom.min.js dan xzoom.css. jika anda belum mempunyai download di google
2 | < script src = "jquery.min.js" ></ script > |
5 | < link rel = "stylesheet" href = "css/xzoom.css" > |
8 | < script src = "js/xzoom.min.js" ></ script > |
2. Tambahkan markup xzoom di file html yang anda kerjakan, anda dapat menambahkan banyak gambar, disini saya contohkan dengan 4 gambar.
01 | < img class = "xzoom" src = "path/to/preview_image_01.jpg" xoriginal = "path/to/original_image_01.jpg" /> |
03 | < div class = "xzoom-thumbs" > |
04 | < a href = "path/to/original_image_01.jpg" > |
05 | < img class = "xzoom-gallery" width = "80" src = "path/to/thumbs_image_01.jpg" xpreview = "path/to/preview_image_01.jpg" > |
07 | < a href = "path/to/original_image_02.jpg" > |
08 | < img class = "xzoom-gallery" width = "80" src = "path/to/preview_image_02.jpg" > |
10 | < a href = "path/to/original_image_03.jpg" > |
11 | < img class = "xzoom-gallery" width = "80" src = "path/to/preview_image_03.jpg" > |
13 | < a href = "path/to/original_image_04.jpg" > |
14 | < img class = "xzoom-gallery" width = "80" src = "path/to/preview_image_04.jpg" > |
3. Inisial gambar yang akan diperbesar
$(
".xzoom"
).xzoom();
4. Semua code dengan value default.
63 | sourceClass: 'xzoom-source' , |
66 | loadingClass: 'xzoom-loading' , |
69 | lensClass: 'xzoom-lens' , |
72 | zoomClass: 'xzoom-preview' , |
75 | activeClass: 'xactive' , |
87 | adaptiveReverse: false , |
93 | titleClass: 'xzoom-caption' , |
5. Fungsi ini dapat digunakan dengan integrasi galeri agar tampilan lebih profesional
01 | // Function that is called on initialization step, that is binding an event "mouseenter" to the passed jQuery object "element" which is originnaly a main source image. |
02 | // And giving a function that need to be called when event will be triggered "instance.openzoom". |
03 | instance.eventopen = function(element) { |
04 | element.bind('mouseenter', instance.openzoom); |
07 | // Function that is called on the step when it is needed to bind an event to the element on which the leaving will be tracked. |
08 | instance.eventleave = function(element) { |
09 | element.bind('mouseleave', instance.closezoom); |
12 | // Function that is called on the step when it is needed to bind an event to the element on which the moving will be tracked. |
13 | instance.eventmove = function(element) { |
14 | element.bind('mousemove', instance.movezoom); |
17 | // Function that is called on the step when it is needed to bind an event to the element on which the scrolling for scale will be tracked. |
18 | instance.eventscroll = function(element) { |
22 | // Function that is called on the step when it is needed to bind an event to the element on which the click will be tracked. |
23 | instance.eventclick = function(element) { |
24 | element.bind('click', function(event) { |
25 | $('#main_image').trigger('click'); |
29 | // Function to open zoom, uses event.pageX and event.pageY as start location of lens. |
30 | instance.openzoom(event) |
32 | // Has no parameters, and simply closing the zoom. |
35 | // This function also uses event.pageX and event.pageY to be able to provide movement of lens on the zoom. |
36 | instance.movezoom(event) |
38 | // This function is adapted for "mousewheel", "DOMMouseScroll" events and tested, and works fine on all major browsers. |
39 | // But if you are using some custom events where you will call this function directly then you can use event.xdelta as delta with value 0 or 1 to tell the direction of scaling by 5% from each call, or event.xscale for exact scale with value from -1 to 1 (which means -100% to 100%) to set up exact scale of the zoom as you need. |
40 | instance.xscroll(event) |
42 | // Function that will delete original instance.event* functions by replacing them with blank functions and unbind default events on objects. |
43 | // It can help you to clear default mouse binding events that xzoom already setup. |
46 | // Function that will restore original instance.event* functions. |
47 | instance.eventdefault() |
Mudah bukan, tinggal ikutin petunjuk yang saya buat nanti akan sesuai apa yang di inginkan...
apa masih males copy paste? saya aja yang bikin tidak males, anda yang masih belajar ko malah males pie to?
Yowis nih saya kasih link downloadnya. tapi jangan lpa share ya..
via Adf.ly silahkan copy link berikut http://viahold.com/2W5W
via shorte.st ambil di link http://destyy.com/q14y9x