O plug-in do PhotosWipe pode perceber que a tela cheia aumenta o zoom no telefone celular e clique duas vezes na imagem para ampliar a imagem.
Site oficial do PhotosWipe Plugin http://www.photoswipe.com/
Mas uma coisa não é boa nisso. Depois de ampliar a foto, você não pode fechar a navegação. Você deve clicar no botão Fechar ou deslizar para fechá -lo. Depois de procurar muito tempo, você ainda não mencionou esse ponto. Você só pode mudar isso sozinho.
Open PhotosWipe.js, há uma definição de função sobre Tap on Line 3179
Defina uma variável no começo
var tap_num = 0;
Em seguida, adicione -o na definição de ONTAPSTART
// Adicione aos s adicionar por si mesmo de acordo com as necessidades // documentar se deve clicar ou clicar duas vezes para fechar o clique duas vezes para ampliar o Tap_num ++; if (tap_num <2) {setTimeout (function () {if (tap_num> 1) {tap_num = 0; return;} else {tap_num = 0; // defende se houver ou não. você mesmo de acordo com as necessidadesProvavelmente esse é o todo
var taptimer, tapreleasePoint = {}, _dispatchTapevent = function (origevent, liberação de liberação, pointertype) {var e = document.Createevent ('customevent'), eDetoin = {origevent: origem: alvo: origem.Target, lemeSoPoint: {Origevent: origem: origem. 'tocar' }; E.Initcustomevent ('PswPtap', verdadeiro, verdadeiro, eDetail); origevent.target.dispatchEvent (e); }; var tap_num = 0; _registerModule ('Tap', {publicMethods: {inittap: function () {_listen ('FirstTouchStart', self.ontapstart); _listen ('touchrelease', self.ontaLease); _listen ('' '', funcionar () ('touchrelease', self.ontaLease); _listen ('' '', function, (', ('; }); 1) {Tap_num = 0; {return; P0); ||. _equalizePoints (TapreleasePoint, p0);Compressa o photoswipe.js modificado para realizar as funções que você deseja
Além disso, o uso do plug -in PhotosWipe requer estruturas de inserção e código JavaScript, que podem ser integrados a um JS e depois introduzidos, para que a página pareça muito mais simples.
Primeiro, escreva a estrutura do álbum de imagem no HTML e combine o estilo
<div id = "Demo-Test-Gallery"> <a href = "https://farm4.staticflickr.com/3894/15008518202_c265dfa55f_h.jpg" Data-size = "1600x1600" data-med = "https://farm4.staticflickr.com/3894/15008518202_b016d7d289_b.jpg" data-med-size = "1024x1024"> <mg src = "https://farm4.staticflickr.com/3894/15008518202_b016d7d289_m.jpg"/> </a> <a href = "https://farm6.staticflickblick/5591/158887111010101010101016101. data-size = "1600x1068" data-med = "https://farm6.staticflickr.com/5591/15008867125_68a8ed88cc_b.jpg" data-med-size = "1024x1024"> <img. src = "https://farm6.staticflickr.com/5591/15008867125_68a8ed88cc_m.jpg"/> </a> </div>
JS organizado
document.writeln ("<!-elemento raiz do photosWipe. Deve ter classe Pswp.->"); document.writeln ("<div class =/" pswp/"tabindex =/"-1/"role =/" dialog/"aria-hidden =/" true/">"); document.writeln ("<! A opacidade é mais rápida que RGBA (). Class =/"PSWP__Scroll-wrap/"> "); document.writeln (" <!-contêiner que mantém slides. "); document.writeln (" photoswipe mantém apenas 3 deles no DOM para salvar a memória. class =/"pswp__Item/"> </div> "); document.writeln (" <div class =/"pwp__item/"> </div> "); document.writeln (" <div class =/"pswp__item/"> </div> "); document.writeln (" <divs class =/"PSWP__Item/"> </div> "); document.writeln (" "); document.writeln (" "); document.writeln (" "); document.writeln (" "); document.writeln (" <!-default. class =/"PSWP__UI PSWP__UI-Hidden/"> "); document.writeln (" "); document.writeln (" <!-controles são auto-explicativos. O pedido pode ser alterado.-> "); document.writeln (" "); document.writeln (" class =/"PSWP__Counter/"> </div> "); document.writeln (" "); document.writeln (" <butt class =/"pswp__button pwp__button-close/" title =/"close (esc)/"> <//butão>); pwp__button-share/"title =/" share/"> <// button>"); document.writeln (""); document.writeln ("<butt class =/" pwp__button pwp__button-fs/"title =/" toggle fullcreen/"> <// button>"); Demo http:///codepen.io//dimsemenov//pen//yybwor-> "); document.writeln (" <!-elemento obterá classe PSWP__PRELOADER-ACTIVE "PSWP (PSWP (PSWP (" PSWP (Documorn) ("), quando o prelaader está executando->"); class =/"pswp__preloader__icn/"> "); document.writeln (" <div class =/"pwp__preloader__cut/"> "); document.writeln (" <div class =/"pswp__preloader__cut/"> "); document.writeln (" class =/"pwp__preloader__donut/"> </div> "); document.writeln (" </div> "); document.writeln (" </div> "); document.writeln (" </div> "); document.writel (" </; class =/"pswp__share-modal pswp__single-tap/"> "); document.writeln (" <div class =/"pwp__share-modal pswp__single-tap/"> "); document.writeln (" <div class =/"pSwp__share-tooltip/"> </" </div> "); document.writeln (" "); document.writeln (" <botão class =/"pswp__button pwp__button-acarrow-left/" title =/"anterior (seta esquerda)/"> "); document.writeln (" </button> "); pwp__button-marrow-right/"title =/" a seguir (seta direita)/">"); document.writeln ("</div>"); document.writeln (""); document.writeln ("<div class =/" pswp__caption/">); document.writeln (" class =/"pswp__caption__Center/"> </div> "); document.writeln (" "); document.writeln (" "); document.writeln (" "); document.writeln (" "); document.writeln (" "); document.writeln ("); docum Ent.Writeln (""); document.writeln (""); document.writeln (""); document.writeln (""); document.writeln (""); document.writeln (""); document.writeln (""); document.writeln (""); document.w riteln (""); document.writeln (""); document.writeln (""); document.writeln (""); document.writeln (""); document.writeln (""); document.writeln (""); document.writeln (""); document.write ln (""); document.writeln (""); document.writeln (""); document.writeln (""); document.writeln (""); document.writeln (""); document.writeln (""); document.writeln ("); document.writeln (" <// div> "); document.writeln (" "); document.writeln (" </div> "); (function () {var initphotosWipeFromdom = function (GallerySelector) {var ParsethUMBNailElements = thhumblements = thumben. Thumbnailel, item; el.getAttribute ('href'), w: parseint (tamanho [0], 10), h: parseint (tamanho [1], 10), autor: el.getattribute ('data-autor')}; ChildElements [0] .getAttribute ('src'); el.getAttribute ('Data-size'). Split ('x'); Items.push (itens de retorno; FALSO; NumChildNodes = ChildNodes.Length, NodeIndex = 0, Index; 0 i <vars.lenght; Openphotoswipe = função (Índice, Galleryelement, desableanimation, fromurl) {var pwpeLement = document.QuerySelectorAll ('. getthumbboundsfn: function (índice) {// Consulte Opções-> GetthumbBoundsfn Seção dos documentos para obter mais informações var thumbnail = itens [index] .el.Children [0], PageyScroll = Window.PageyoffSet || + PageyScroll, W: Rect.Width}; Item.author + 'Small>'; para (var j = 0; J <Items.Length; // passa dados para o PhotosWipe e inicialize a galeria = novo PhotosWipe (PSWPELEMENT, PhotosWipeui_Default, itens, opções); Gallery.Listen ('BeforeReSize', function () {var dppiratio = window.devicePixelratio? Window.DevicePixelratio: 1; dpiratio = math.min (dpiratio, 2.5); realViewPortWidthThThth.ViewPortSize.x * dpire; && RealViewPortWidth> 800) || Gallery.invalidatecurritems (); item.src = item.m.src; Galleryelements [i] .SetAttribute ('Data-Pswp-UID', i+1); OpenPhotoSwipe (Hashdata.pid, Galleres [Hashdata.gid - 1], verdadeiro, verdadeiro);O exposto acima é todo o conteúdo deste artigo. Espero que seja útil para o aprendizado de todos e espero que todos apoiem mais o wulin.com.