Skip to content

Commit

Permalink
Fixed max z-index behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
prochor666 committed Jan 5, 2017
1 parent b3d37f4 commit 4afc0fe
Show file tree
Hide file tree
Showing 9 changed files with 133 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
npm-debug.log
14 changes: 10 additions & 4 deletions dist/js/julia-box.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* JuliaBox - HTML5 lightbox
*
* @author [email protected]
* @version: 0.5.6
* @build: 2016-12-16
* @version: 0.5.7
* @build: 2017-01-05
* @license: MIT
*
* @require: jquery
Expand Down Expand Up @@ -126,7 +126,7 @@ var JuliaBox = function(options)
},
timeout: origin.options.timeout,
timer: false,
version: '0.5.5',
version: '0.5.7',
videoAutoplay: origin.options.videoAutoplay,
};

Expand Down Expand Up @@ -456,7 +456,7 @@ JuliaBox.prototype._Ui = function(origin)
{
var indexHighest = 0;

$("*").each(function()
$(":visible").each(function()
{
// always use a radix when using parseInt
var _current = parseInt( $(this).css("z-index"), 10 );
Expand All @@ -471,6 +471,12 @@ JuliaBox.prototype._Ui = function(origin)
'Highest z-index': indexHighest
});

// Fix for highest 32bit integer
if( indexHighest >= 2147483647 )
{
indexHighest = indexHighest - 5;
}

origin.env.instance.css({
'z-index': indexHighest + 1
});
Expand Down
2 changes: 1 addition & 1 deletion dist/js/julia-box.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ gulp.task('finalbuild', function()
properties: false
}
})).pipe(gulp.dest('dist/js'));
})
});


// Watch it, Gulp!
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "juliabox",
"version": "0.5.6,
"version": "0.5.6",
"description": "Responsive, mobile ready lightbox",
"main": "dist/js/julia-box.js",
"scripts": {
Expand Down
112 changes: 109 additions & 3 deletions plugin/julia-plugin-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ var JuliaBox = function(options)
},
timeout: origin.options.timeout,
timer: false,
version: '0.5.6',
version: '0.5.7',
videoAutoplay: origin.options.videoAutoplay,
};

Expand Down Expand Up @@ -152,7 +152,107 @@ var JuliaBoxVirtual = function(options)
// Default origin.options
var _options = {
sources: {},
attr: '
attr: 'href',
root: $('body'),
};

var __VIRTUAL_ID__ = Math.floor((Math.random()*10000000)+1);

// Extend default origin.options with external options
$.extend(true, _options, options);





var isDOMElement = function( obj )
{
var _checkInstance = function(elem)
{
if( ( elem instanceof jQuery && elem.length ) || elem instanceof HTMLElement )
{
return true;
}

return false;
}

if( obj instanceof HTMLCollection && obj.length )
{
for( var a = 0, len = obj.length; a < len; a++ )
{

if( !_checkInstance( obj[a] ) )
{
return false;
}
}

return true;

} else {

return _checkInstance( obj );
}
};




var normalize = function( item )
{
var norm = $('<a />');

if( typeof item === 'string' )
{
norm.attr( _options.attr, item );
}

if( ( typeof item === 'object' && !isDOMElement( item ) ) )
{
if( item.hasOwnProperty('href') )
{
norm.attr( _options.attr, item.href );

}else if( item.hasOwnProperty('src') )
{
norm.attr( _options.attr, item.src );
}

if( item.hasOwnProperty('title') )
{
norm.attr( 'title', item.title );
}else{
norm.attr( 'title', '' );
}
}

norm.css({
'display': 'none'
});

return norm;
};





_collection = $('<div class="---julia-virtual-gallery-'+__VIRTUAL_ID__+'--- julia-virtual-gallery" style="display: none;" />');


for( index in _options.sources )
{
_item = normalize( _options.sources[index] );
_collection.append( _item );
}

_options.root.append( _collection );
result = _collection.find('a').juliaBox( _options );

return result;
};

/* *****************************************
* JuliaBox HTML5 lightbox
* User interface
Expand Down Expand Up @@ -319,7 +419,7 @@ JuliaBox.prototype._Ui = function(origin)
{
var indexHighest = 0;

$("*").each(function()
$(":visible").each(function()
{
// always use a radix when using parseInt
var _current = parseInt( $(this).css("z-index"), 10 );
Expand All @@ -334,6 +434,12 @@ JuliaBox.prototype._Ui = function(origin)
'Highest z-index': indexHighest
});

// Fix for highest 32bit integer
if( indexHighest >= 2147483647 )
{
indexHighest = indexHighest - 5;
}

origin.env.instance.css({
'z-index': indexHighest + 1
});
Expand Down
2 changes: 1 addition & 1 deletion src/js/julia-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ var JuliaBox = function(options)
},
timeout: origin.options.timeout,
timer: false,
version: '0.5.6',
version: '0.5.7',
videoAutoplay: origin.options.videoAutoplay,
};

Expand Down
8 changes: 7 additions & 1 deletion src/js/julia-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ JuliaBox.prototype._Ui = function(origin)
{
var indexHighest = 0;

$("*").each(function()
$(":visible").each(function()
{
// always use a radix when using parseInt
var _current = parseInt( $(this).css("z-index"), 10 );
Expand All @@ -179,6 +179,12 @@ JuliaBox.prototype._Ui = function(origin)
'Highest z-index': indexHighest
});

// Fix for highest 32bit integer
if( indexHighest >= 2147483647 )
{
indexHighest = indexHighest - 5;
}

origin.env.instance.css({
'z-index': indexHighest + 1
});
Expand Down
4 changes: 2 additions & 2 deletions src/js/julia-umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* JuliaBox - HTML5 lightbox
*
* @author [email protected]
* @version: 0.5.6
* @build: 2016-12-16
* @version: 0.5.7
* @build: 2017-01-05
* @license: MIT
*
* @require: jquery
Expand Down

0 comments on commit 4afc0fe

Please sign in to comment.