Reputation: 1001
For starters; Im a big jQuery/Javascript newbie. Im making a responsive website which is including the SlidesJS slider. My fundamental problem is that I wonna change the height of the slider according to the window width:
If window width < 767px set height to 600. else set height to 400.
You set the SlidesJS value with this jQuery code(the height i want to make flexible):
$(function() {
$('#slides').slidesjs({
width: 940,
height: 400,
play: {
active: true,
auto: true,
interval: 4000,
swap: true
}
});
});
Upvotes: 1
Views: 362
Reputation: 104785
This should work
$(function() {
$('#slides').slidesjs({
width: 940,
height: setWindowHeight(),
play: {
active: true,
auto: true,
interval: 4000,
swap: true
}
});
});
function setWindowHeight() {
return ($(window).width() < 767) ? 600 : 400;
}
Upvotes: 1