Why is my line of code not working , even though the function is firing inside bxslider.
iam just using bxslider and came across a funny fug
MY PAGE . the
BUG can be seen in discussion on that thread.
my jQuery initialization code is as follows:
- $(window).on('load' , function(){
-
- var bxslider = $('.projects .bx-slider').bxSlider({
- mode: 'vertical',
- minSlides: 3,
- slideWidth:304,
- slideMargin: 8,
- onSlideAfter: function(elem , old , newi){
- /*var idx = elem.index(),
- src = $('.bx-slider li').eq(idx).find('img').attr('src');
- console.log(elem.index());
- $('.active-project-img img').attr('src' , src);*/
- },
- onSliderLoad: function(){
- // alert('yel');
- console.log('loaded');
- $(".projects .bx-slider").css("visibility", "visible");
- }
-
- });
-
-
- $(window).on('resize' , function(){
-
- if($(window).width() < 992 ) {
- bxslider.reloadSlider({
- mode: 'horizontal',
- minSlides: 3,
- maxSlides:4,
- slideWidth:304,
- slideMargin: 8,
- onSlideAfter: function(elem , old , newi){
- /*var idx = elem.index(),
- src = $('.bx-slider li').eq(idx).find('img').attr('src');
- console.log(elem.index());
- $('.active-project-img img').attr('src' , src);*/
- }
- });
-
- } else {
- bxslider.reloadSlider({
- mode: 'vertical',
- minSlides: 3,
- slideWidth:304,
- slideMargin: 8,
- onSlideAfter: function(elem , old , newi){
- /*var idx = elem.index(),
- src = $('.bx-slider li').eq(idx).find('img').attr('src');
- console.log(elem.index());
- $('.active-project-img img').attr('src' , src);*/
- }
- });
-
- }
-
- dynamicHeight();
-
- /* To give height to main image container */
-
-
- }).trigger('resize');
-
- });
The code pertaining to this BUG is here:
- var bxslider = $('.projects .bx-slider').bxSlider({
- mode: 'vertical',
- minSlides: 3,
- slideWidth:304,
- slideMargin: 8,
- onSlideAfter: function(elem , old , newi){
- /*var idx = elem.index(),
- src = $('.bx-slider li').eq(idx).find('img').attr('src');
- console.log(elem.index());
- $('.active-project-img img').attr('src' , src);*/
- },
- onSliderLoad: function(){
- // alert('yel');
- console.log('loaded');
- $(".projects .bx-slider").css("visibility", "visible");
- }
-
- });
ok , so now i have hidden.bx-slider in the css using visibility:hidden , and when the slider images are done loading , the onSliderLoad function is supposed to fire and
IT DOES !! .. but this line , inside the function :
- $(".projects .bx-slider").css("visibility", "visible");
has no effect what so ever , now if i go and post the line in the the console and hit enter
IT WORKS !! . but why is that line of code not working issue the function and also how do i solve this issue of bxslider loading infinity ! ?