help ddslick jquery plugin

0

Hello community I found this library of dynamic selects in jquery ddslick I would like to know if anyone has knowledge of it, the library has two forms If you are looking for the documentation you will see what I mean, because I am using the normal way I am doing the following ..

<!--este select es cconfigurado por la libreria hace que le puedas agragar imagenes  -->
<select id="demo-htmlselect">
    <option value="0" data-imagesrc="http://i.imgur.com/XkuTj3B.png"
        data-description="Description with Facebook">Facebook</option>
    <option value="1" data-imagesrc="http://i.imgur.com/8ScLNnk.png"
        data-description="Description with Twitter">Twitter</option>
    <option value="2"  data-imagesrc="http://i.imgur.com/aDNdibj.png"
        data-description="Description with LinkedIn">LinkedIn</option>
    <option value="3" data-imagesrc="http://i.imgur.com/kFAk2DX.png"
        data-description="Description with Foursquare">Foursquare</option>
</select>

and the code js for this to work is this

$(document).ready(function(){

   $('#demo-htmlselect').ddslick({

    onSelected: function(Data){//esto es como el on change 
        alert(Data.selectedData.value);//y asi se obtiene el valor
         return false;
    }   
    });

});

well the thing is that I always select a value when loading the page and I do not want that because through the onSelected: function in my original code I have 5 of these selects and all do calls ajax then when loading the page all the selects are executed making 5 calls ajax thing that even the browser becomes slow, as I could do in this library so that I do not Is this selecting a default value? that is, this executan the function onSelected without even me doing that action, in the Documentation this is how the library is used but I do not give with the error.

I leave a sniper delo that makes me the library and to see how it looks I hope you can help me thanks!

   $('#demo-htmlselect').ddslick({

         Data:false,
         selectedIndex:null,//intente poner index nul pero nada
        
    onSelected: function(Data){
        alert(Data.selectedData.value);
         return false;
    }   
});
 <select id="demo-htmlselect">
        <option value="0" data-imagesrc="http://i.imgur.com/XkuTj3B.png"
            data-description="Description with Facebook">Facebook</option>
        <option value="1" data-imagesrc="http://i.imgur.com/8ScLNnk.png"
            data-description="Description with Twitter">Twitter</option>
        <option value="2" selected="selected" data-imagesrc="http://i.imgur.com/aDNdibj.png"
            data-description="Description with LinkedIn">LinkedIn</option>
        <option value="3" data-imagesrc="http://i.imgur.com/kFAk2DX.png"
            data-description="Description with Foursquare">Foursquare</option>
    </select>
    
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>  
    
      <script type="text/javascript" src="https://cdn.rawgit.com/prashantchaudhary/ddslick/master/jquery.ddslick.min.js" ></script>
    
    
asked by andy gibbs 26.09.2018 в 19:24
source

0 answers