Advertisement
Guest User

Untitled

a guest
Sep 30th, 2014
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. slidesjs.update = function (element, position) {
  2.   element.each(function () {
  3.     var $this = $(this);
  4.     var defaults;
  5.  
  6.       // http://www.levihackwith.com/element-dataset-not-supported-in-ie-heres-a-workaround/
  7.       //if ($this[0].dataset === undefined) {
  8.         defaults = $this[0].getAttribute('data-defaults');
  9.       //} else if ($this[0].dataset.hasOwnProperty('defaults')) {
  10.       //  defaults = $this.data('defaults');
  11.       //}
  12.       if (defaults) {
  13.         if (defaults.options.aspect.rect) {
  14.           $this.height(project.utility.getRatio.calc16x9($this.width()));
  15.         } else if (defaults.options.aspect.sqr) {
  16.           $this.height(project.utility.getRatio.calc4x3($this.width()));
  17.         } else if (defaults.options.columns) {
  18.           $this.height(Math.floor($this.width() / defaults.options.columns));
  19.         }
  20.       }
  21.  
  22.     if ($('.slidesjs-navigation', this).length) {
  23.       var nav = $('.slidesjs-navigation', this);
  24.  
  25.       if (nav.is(':visible')) {
  26.         var pos = Math.floor($this.height() / 2) - Math.floor(nav.height() / 2);
  27.        
  28.         if (!position) {
  29.           nav.css('top', pos);
  30.         } else {
  31.           nav.css('top', position);
  32.         }
  33.       }
  34.     }
  35.   });
  36. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement