Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript DRY Coding with enqire.js and elastislide

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #40324
    tdevine33
    Member

    I’m using elastislide in a new responsive project – along with enquire.js and feel like there is a better, cleaner and DRY (don’t repeat yourself) solution for it.


    enquire
    .register('screen and (max-width: 699px)', function() {
    // carousel settings
    $('#carousel').elastislide({
    imageW : 286,
    minItems : 2,
    border : 7,
    margin : 20,
    onClick : function() {
    window.open($item.index);
    }
    });
    })
    .register('screen and (min-width: 700px)', function() {
    // carousel settings
    $('#carousel').elastislide({
    imageW : 286,
    minItems : 3,
    border : 7,
    margin : 30,
    onClick : function() {
    window.open($item.index);
    }
    });
    })
    .listen();

    Is there a way to set all plugin settings by default and then only the ones I want changed for the different sizes to cut down on the number of repeats? Any help would be greatly appreciated

Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.