Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions jquery.ellipsis.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,19 @@

// only bind to window resize if required
if (base.opts.responsive) {
var windowWidth = $(window).width();

/**
* resize() resets necessary vars
* and content and then re-initialises
* the Ellipsis script
*/
var resize = function() {
if ($(window).width() == windowWidth) {
return;
}
windowWidth = $(window).width();

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@taberrr, thanks for this fix. It would be great if you could cache the window reference and add a comment explaining why this is required though please if you don't mind?

if (base.opts.responsive) {
  var $window = $(window);
  var windowWidth = $window.width();

  var resize = function() {
    // Scrolling on iOS6+ fires the resize event. This ensures the width has actually changed
    // before continuing. https://tinyurl.com/ios-scroll-resize
    if ($window.width() === windowWidth) {
      return;
    }
    
    windowWidth = $window.width();
    //etc.
  }

  $window.on('resize.' + namespace, resize);
}

lines = [];
currLine = 0;
currOffset = null;
Expand Down
2 changes: 1 addition & 1 deletion jquery.ellipsis.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.