How can I make a function work differently for desktops and for mobiles?

Without seeing the code, you need to explicitly set the height of the slider using media queries in CSS. This may or may not work, depending on how the JavaScript for the slider works.

.slider-selector {
    height: 300px;
}

@media ( min-width: 769px ) {
    .slider-selector {
         height: 600px;
    }
}