Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    sovrascrivere opzioni plugin jquery dall'esterno

    ciao vorrei customizzare una lightbox che si aziona aggiungendo dei tag a dei link, vorrei sovrascrivere le opzioni di default aggiungendo le opzioni nell'attributo data del link ma la lightbox lo trova undefined c'è un altro modo per sovrascrivere questo codice?? grazie dell'aiuto

    codice:
    function Lightbox(options) {
        this.album = [];
        this.currentImageIndex = void 0;
        this.init();
        //alert($(this).data( "settings" ));
        this.options = $.extend({}, this.constructor.defaults);
        this.option(options);
      }
    
     
         
      Lightbox.defaults = {
        albumLabel: 'Image %1 of %2',
        alwaysShowNavOnTouchDevices: false,
        fadeDuration: 500,
        fitImagesInViewport: true,
        // maxWidth: 800,
        // maxHeight: 600,
        positionFromTop: 50,
        resizeDuration: 700,
        showImageNumberLabel: true,
        wrapAround: false,
     
      };
    avevo provato a passare dei dati cosi
    codice:
     
    $( "#pop1" ).data( "settings", { first: 16, last: "pizza!" } );

  2. #2
    i dati li riesco a passare, ma ancora non riesco a renderli visibili fuori dall funzione questo è il codice
    codice:
     Lightbox.prototype.enable = function() {
        var self = this;
        $('body').on('click', 'a[rel^=lightbox], area[rel^=lightbox], a[data-lightbox], area[data-lightbox]', function(event) {
            
          
          self.start($(event.currentTarget));
          var divrel=$(this).attr('rel');
          self.Popup(divrel);
            
          
          settingsvar=$(this).data('settings');
         
          return false;
        });
    come faccio a rendere visibile questa variabile fuori da
    Lightbox.prototype.enable = function() {
    ??

    this.settingsvar=$(this).data('settings');

    devo leggerla qui ma mi da undefined
    codice:
    function Lightbox(options) {
        this.album = [];
        this.currentImageIndex = void 0;
        this.init();
        
        alert(this.settingsvar);
        this.options = $.extend({}, this.settingsvar);
        this.option(options);
      }
    Ultima modifica di surferbloggy; 10-10-2015 a 22:15

  3. #3
    come faccio ad aggiornare le opzioni al click da una funzione all'altra questo è il codice
    codice:
    function Lightbox(options) {
        this.album = [];
        this.currentImageIndex = void 0;
        this.init();
        //this.options = $.extend({}, this.constructor.defaults); 
        this.options = $.extend({}, s);
        this.option(options);
      }
    
    
         
      Lightbox.prototype.option = function(options) {
          
        $.extend(this.options, options);
         
      };
    
      Lightbox.prototype.init = function() {
        this.enable();
        this.build($(this).attr('rel'));
      
         
         
      };
    
      
      Lightbox.prototype.enable = function() {
        var self = this;
        $('body').on('click', 'a[rel^=lightbox], area[rel^=lightbox], a[data-lightbox], area[data-lightbox]', function(event) {
            
       
          self.start($(event.currentTarget));
          var divrel=$(this).attr('rel');
          self.flipPopup(divrel);
            
       
            s=$(this).data('settings');
          
            self.option(s);
          
          return false;
        });
        
      };
    ho provato con self.option(s);
    ad aggiornare
    this.options = $.extend({}, s);
    nella funzione function Lightbox(options) {

    come potrei fare??

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.