| Current Path : /home/digilove/public_html/templates/sj_revo/js/ |
| Current File : /home/digilove/public_html/templates/sj_revo/js/ytsticky.js |
jQuery(document).ready(function($){
//refresh the screen on browser resize?
var YTScript = window.YTScript = window.YTScript || {
slidePositions:function(wrap, txt, events){
$i = 0;
$(wrap).find('div.module').each(function(){
var $this = $(this);
w_btn = $this.find('.btn-special').width();
$this.css('top', $i*(w_btn+5)); $i++;
$(wrap).find('div.module').removeClass('active');
$this.css('width', $this.width());
$this.css(txt, - $this.width());
$this.find('.btn-special').bind(events, function(){
//if($this.attr('class').contains('active')){
if ( $this.attr('class').indexOf("active") !== -1 ){
// btn
if(txt == 'left')
$this.animate({'left': w_btn }, 200, function(){
$this.show().animate({'left':- $this.width()});
});
else
$this.animate({'right': w_btn }, 200, function(){
$this.show().animate({'right':- $this.width()});
});
// Module content
if(txt == 'left')
$(this).animate({'left': - w_btn}, 200, function(){
$(this).show().animate({'left': $this.width()});
});
else
$(this).animate({'right': - w_btn}, 200, function(){
$(this).show().animate({'right': $this.width()});
});
// Class active
$this.removeClass('active');
}else{
// Other modules
$(wrap).find('div.module').each(function(){ //alert(txt);
o_mod = $(this);
(txt == 'left')?o_mod.animate({'left': - o_mod.width()}, 200):o_mod.animate({'right': - o_mod.width()}, 200);
o_mod.removeClass('active');
(txt == 'left')?o_mod.find('.btn-special').animate({'left': o_mod.width()}, 200):o_mod.find('.btn-special').animate({'right': o_mod.width()}, 200);
});
// btn
if(txt == 'left')
$(this).animate({'left': $this.width()}, 200, function(){
$(this).show().animate({'left': - w_btn});
});
else
$(this).animate({'right': $this.width()}, 200, function(){
$(this).show().animate({'right': - w_btn});
});
// Module content
if(txt == 'left')
$this.animate({'left':- $this.width()}, 200, function(){
$this.show().animate({'left': w_btn});
});
else $this.animate({'right':- $this.width()}, 200, function(){
$this.show().animate({'right': w_btn});
});
// Class active
$this.addClass('active');
}
})
});
},
slidePositionNotice:function(wrap, txt, cookiename){
var $this = $(wrap);
h_modcontent = screen.height;
$this.css('height', h_modcontent);
$this.prepend("<div class='btn-special-close'><i class='fa fa-close'></i></div>" );
$this.after("<div class='btn-special sticky-top hidden-sm hidden-xs'><i class='fa fa-bars'></i></div> " );
if(txt == 'top'){
var $this = $(wrap);
$this.css('top', - h_modcontent);
$this.next().filter('.btn-special').click(function(){
$this.next().filter('.btn-special').animate({bottom:"0"},function(){
$this.animate({'top':0});
});
$this.addClass('active');
createCookie(TMPL_NAME+'_'+cookiename, 1, 7);
});
$this.children('.btn-special-close').click(function(){
$this.animate({'top':- h_modcontent+'px'},function(){
$this.children('.btn-special').animate({bottom:"-130px"});
});
$this.removeClass('active');
createCookie(TMPL_NAME+'_'+cookiename, 0, 7);
});
}else {
$this.css('bottom', - h_modcontent);
$this.children('.btn-special').click(function(){
$('#yt_wrapper').animate({'padding-bottom':$this.height()+'px'});
$this.children('.btn-special').animate({bottom:"0",opacity:'0'},function(){
$this.animate({'bottom':0});
});
$this.addClass('active');
createCookie(TMPL_NAME+'_'+cookiename, 1, 7);
});
$this.children('.btn-special-close').click(function(){
$('#yt_wrapper').animate({'padding-bottom':0});
$this.animate({'bottom':- $this.height()+'px'},function(){
$this.children('.btn-special').animate({bottom:"-130px",opacity:'1'});
});
$this.removeClass('active');
createCookie(TMPL_NAME+'_'+cookiename, 0, 7);
});
}
}
}
});