Boris Akimenko pro asked 7 years ago


Hi guys! I've got a buttheart with "data-size" attribute of link which calls lightbox. I have different sizes of images because of landscape and portrait orientation in one gallery. So I deside this bad :) I just fix only width and set data-size="1600x", for example. After line 15022 size = linkEl.getAttribute('data-size').split('x'); I just add var linkElC = linkEl.children[0], linkElW = linkElC.naturalWidth / linkElC.naturalHeight; and
           // create slide object
            item = {
                src: linkEl.getAttribute('href'),
                w: parseInt(size[0], 10),
                h: parseInt(size[1], 10)
            };
change to
           // create slide object
            item = {
                src: linkEl.getAttribute('href'),
                w: parseInt(size[0], 10),
                h: parseInt(size[1] || size[0] / linkElW, 10)
            };
. You can use include it in future and make a code for calculating width too if height in data-size was setted. As data-size="x900" for example.

Marta Wierzbicka staff answered 7 years ago


Hello Boris, thank you for your solution, we'll look at this and include in the future. Best, Marta

Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: General Bootstrap questions
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: Yes
  • Provided link: No