Skip to content

Commit

Permalink
Tweaks to pull #604
Browse files Browse the repository at this point in the history
  • Loading branch information
Mottie committed Mar 4, 2016
1 parent b72e317 commit add5f33
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 127 deletions.
61 changes: 30 additions & 31 deletions demos/css/page.css
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ ul li { font: 15px Georgia, Serif; margin: 0 0 8px 0; }
#main #slider2 { width: 800px; height: 390px; list-style: none; }

/* Set slider1 panel 5 stuff - adding padding directly to the panel will
shift panels after it, so we need a wrapper */
shift panels after it, so we need a wrapper */
#main #slider1 .panel5 ul { width: 200px; margin: 0 5px; }

/* Set slider2 panel sizes, Main & FX demo pages */
Expand Down Expand Up @@ -79,7 +79,7 @@ ul li { font: 15px Georgia, Serif; margin: 0 0 8px 0; }
#cboxTitle { color: #000 !important; }

/* Change metallic slider defaults to show thumbnails -
using #demo2 (page wrapper) to increase this CSS priority */
using #demo2 (page wrapper) to increase this CSS priority */
#demo2 div.anythingControls { bottom: 25px; }
#demo2 div.anythingSlider-metallic .thumbNav a { background-image: url(); height: 30px; width: 30px; border: #000 1px solid; border-radius: 2px; -moz-border-radius: 2px; -webkit-border-radius: 2px; }
#demo2 div.anythingSlider-metallic .thumbNav a span { visibility: visible; }
Expand Down Expand Up @@ -111,10 +111,10 @@ ul li { font: 15px Georgia, Serif; margin: 0 0 8px 0; }
#slider3 .caption-top,
#slider3 .caption-right,
#slider3 .caption-bottom,
#slider3 .caption-left { background: #000; color: #fff; padding: 10px; margin: 0; position: absolute; z-index: 10; opacity: .8; filter: alpha(opacity=80); }
#slider3 .caption-left { background: #000; color: #fff; padding: 10px; margin: 0; position: absolute; z-index: 10; opacity: .8; filter: alpha(opacity=80); }

/* Top caption - padding is included in the width (480px here, 500px in the script), same for height */
#slider3 .caption-top { left: 0; top: 0; width: 480px; height: 30px; }
#slider3 .caption-top { left: 0; top: 0; width: 480px; height: 30px; }

/* Right caption - padding is included in the width (130px here, 150px in the script), same for height */
#slider3 .caption-right { right: 0; bottom: 0; width: 130px; height: 180px; }
Expand Down Expand Up @@ -166,19 +166,18 @@ body#expand h3 { text-align: center; }
.group { border: #000 1px solid; }

/**************************
Updating Video
**************************/

Updating Video
**************************/
#updatingVideoDemo div#slider1, ul#slider1 div {
width: 300px;
height: 200px;
list-style: none;
width: 300px;
height: 200px;
list-style: none;
}

#updatingVideoDemo div#slider2, div#slider2 div {
width: 300px;
height: 200px;
list-style: none;
width: 300px;
height: 200px;
list-style: none;
}

#updatingVideoDemo .updatingVideoDemoInputs {
Expand All @@ -192,29 +191,29 @@ Updating Video
/******************
css3 demo page
******************/
.animations { margin: 20px 20px 20px 5px; }
.ani { margin-top: 10px; }
.animations { margin: 20px 20px 20px 5px; }
.ani { margin-top: 10px; }

/******************
tooltips (Jatt)
******************/
.tooltip { cursor: pointer; }
#tooltip {
min-width: 100px;
color: #dddddd;
background: #444;
border: 1px solid #777;
padding: 8px;
display: none;
opacity: 0.9;
filter: alpha(opacity=90);
text-align: left;
border-radius: .5em;
-moz-border-radius: .5em;
-webkit-border-radius: .5em;
z-index: 1000;
min-width: 100px;
color: #dddddd;
background: #444;
border: 1px solid #777;
padding: 8px;
display: none;
opacity: 0.9;
filter: alpha(opacity=90);
text-align: left;
border-radius: .5em;
-moz-border-radius: .5em;
-webkit-border-radius: .5em;
z-index: 1000;
}
#tooltip .body {
display: block;
text-align: center;
}
display: block;
text-align: center;
}
3 changes: 2 additions & 1 deletion js/jquery.anythingslider.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,8 @@
base.navWidths = base.$nav.find('li').map(function(){
return $(this).outerWidth(true) + Math.ceil(parseInt($(this).find('span').css('left'),10)/2 || 0);
}).get();
base.navLeft = base.currentPage;
// start navLeft at one so calling base.navWindow() will position the current page on the left
base.navLeft = 1;
// add 25 pixels (old IE needs more than 5) to make sure the tabs don't wrap to the next line
base.$nav.width( base.navWidth( 1, base.pages + 1 ) + 25 );
base.$controls.find('.anythingNavWindow')
Expand Down
31 changes: 14 additions & 17 deletions js/jquery.anythingslider.video.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,17 @@
}
// ,onVideoInitialized : function(base){}
};


return this.each(function(){
// make sure a AnythingSlider is attached
var video, tmp, service, sel, base = $(this).data('AnythingSlider');
var video, tmp, service, sel, panel,
base = $(this).data('AnythingSlider');
if (!base) { return; }
//if anythingSliderVideo was initialized before, don't overwrite it
// if anythingSliderVideo was initialized before, don't overwrite it
if(typeof base.video == 'undefined'){
video = base.video = {};
// Next update, I may just force users to call the video extension instead of it auto-running on window load
// then they can change the video options in that call instead of the base defaults, and maybe prevent the
// videos being initialized twice on startup (once as a regular video and second time with the API string)
video.options = $.extend({}, defaults, options);

// check if SWFObject is loaded
video.hasSwfo = (typeof(swfobject) !== 'undefined' && swfobject.hasOwnProperty('embedSWF') && typeof(swfobject.embedSWF) === 'function' && swfobject.hasFlashPlayerVersion('1'));
video.list = {};
Expand All @@ -51,28 +48,28 @@
video = base.video;
video.$items = base.$items.filter(':not(.cloned)');
}

// find and save all known videos
for (service in video.services) { /*jshint loopfunc:true */
if (typeof(service) === 'string') {
sel = video.services[service].selector;
video.$items.find(sel).each(function(){
tmp = $(this);
var pan = tmp.closest('.panel');
if(pan.data('AnythingSliderVideoInitialized') != true){
panel = tmp.closest('.panel');
if (panel.data('AnythingSliderVideoInitialized') != true){
// save panel and video selector in the list
tmp.attr('id', video.options.videoId + $.fn.anythingSliderVideo.videoIndex);
video.list[$.fn.anythingSliderVideo.videoIndex] = {
id : video.options.videoId + $.fn.anythingSliderVideo.videoIndex++,
panel : pan[0],
panel : panel[0],
service : service,
selector : sel,
status : -1, // YouTube uses -1 to mean the video is unstarted
isInitialized : false, //Mark as Initialized to prevent double initialisation on adding video to slider
status : -1, // YouTube uses -1 to mean the video is unstarted
isInitialized : false, // Mark as Initialized to prevent double initialisation on adding video to slider
};

//add indicator that this video was already initialized
pan.data('AnythingSliderVideoInitialized', true);
// add indicator that this video was already initialized
panel.data('AnythingSliderVideoInitialized', true);
video.hasVid = true;
if (sel.match('embed|object')) {
video.hasEmbed = true;
Expand All @@ -84,7 +81,7 @@
});
}
}

// Initialize each video, as needed
$.each(video.list, function(i,s){
// s.id = ID, s.panel = slider panel (DOM), s.selector = 'jQuery selector'
Expand Down Expand Up @@ -275,7 +272,7 @@ $.fn.anythingSliderVideo.services = {
$vid.attr('src', function(i,r){
// initialze api and add wmode parameter
return r + (vidsrc.match(/\?/g) ? '' : '?') + '&wmode=' + (base.video.options.wmode || base.options.addWmodeToObject) +
'&api=1&player_id=' + $vid[0].id;
'&api=1&player_id=' + $vid[0].id;
});
},
cont : function(base, $vid, index){
Expand Down
Loading

0 comments on commit add5f33

Please sign in to comment.