jquery - javascript slider has a wrong size -
i have slider on page: http://en.expo.b24online.com/news/ js silder is: on document ready:
$('#newscarousel').carousel({ interval: 4000 }).on('click', '.list-group li', function() { clickevent = true; $('.list-group li').removeclass('active'); $(this).addclass('active'); }).on('slid.bs.carousel', function(e) { if(!clickevent) { var count = $('.list-group').children().length -1; var current = $('.list-group li.active'); current.removeclass('active').next().addclass('active'); var id = parseint(current.data('slide-to')); if(count == id) { $('.list-group li').first().addclass('active'); } } clickevent = false; });
and on load:
var boxheight = $('#newscarousel .carousel-inner').innerheight(); var itemlength = $('#newscarousel .item').length; var triggerheight = math.round(boxheight/itemlength+1); $('#newscarousel .list-group-item').outerheight(triggerheight); $('.media-img').height(boxheight);
it works fine on places, on website, have the:
$('#newscarousel .carousel-inner').innerheight();
to 133, , makes other dimensions calculate in load function wrong. couldn't find 133 come , how fix it. thank help.
.innerheight()
method not applicable window
, document
objects; these, use .height()
instead.
eg:
$('#newscarousel .carousel-inner').height();
hope help.
Comments
Post a Comment