Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery Mobile; twentytwenty plugin will only show up when the browser window is resized

I'm not sure why this is happening, as I've followed the directions on Zurb's website. It doesn't matter what size the window is upon opening the page with TwentyTwenty, it will only show the slider once the page has been resized. The plugin works flawlessly aside from that. I have a feeling there's some way to adjust the following to make it load without resizing the window...

$(window).load(function() {
  $(".twentytwenty-container").twentytwenty();
});

Maybe? Much appreciated.

like image 519
Rebecca Walsh Avatar asked Nov 30 '25 03:11

Rebecca Walsh


1 Answers

It's a little bug, but fixed by add code. Add this to jquery.twentytwenty.js file:

$(window).load(function() {
   $(window).trigger("resize.twentytwenty");
});
  $.fn.twentytwenty = function(options) {
     var options = $.extend({default_offset_pct: 0.5, orientation: 'horizontal'}, options);

    // >>>>> HERE ADD CODE <<<<<<

     return this.each(function() {

//.......

source: https://github.com/zurb/twentytwenty/pull/69/commits/471a824bf5ab233797d0de689a5be105347c81e2

like image 185
parts2eu Avatar answered Dec 02 '25 20:12

parts2eu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!