Grow your CSS skills. Land your dream job.

DRY Coding with enqire.js and elastislide

  • # October 16, 2012 at 11:04 am

    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)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".