Answer the question
In order to leave comments, you need to log in
How to change the default value?
The site has a news display toggle that adds or removes the colum right class. I want this class to be disabled by default on all devices
var hide_side_trig = 0;
var hide_side = $.cookie("hide_side");
if (hide_side == "1") {
hide_side_trig = 1;
$("#colum_right").hide();
$('.hide_side').addClass("active");
$(".users_news, .boxes_news").addClass("long");
$("#colum_left").animate({"width":"1230px"}, function(){
$(".short_news").each(function(){
$(this).css({"width":"292px"});
});
$('.mas_news').masonry({
itemSelector: '.short_news',
singleMode: false,
isResizable: true,
"gutter": 20,
isAnimated: true,
animationOptions: {
queue: false,
duration: 500
}
});
$.cookie("hide_side", "1", {
expires : 360, //expires in 10 days
path : '/', //The value of the path attribute of the cookie
domian : 'mexalim.com.ua'
});
});
}
$('.hide_side').click(function(){
$("#colum_right").fadeToggle();
$(this).toggleClass("active");
if (hide_side_trig == 0) {
hide_side_trig = 1;
$(".users_news, .boxes_news").addClass("long");
$("#colum_left").animate({"width":"1230px"}, function(){
$(".short_news").each(function(){
$(this).css({"width":"292px"});
});
$('.mas_news').masonry({
itemSelector: '.short_news',
singleMode: false,
isResizable: true,
"gutter": 20,
isAnimated: true,
animationOptions: {
queue: false,
duration: 500
}
});
$.cookie("hide_side", "1", {
expires : 360, //expires in 10 days
path : '/', //The value of the path attribute of the cookie
domian : 'mexalim.com.ua'
});
$('.boxes_slider').bxSlider({
slideSelector:'.boxes_slider_item',
pagerCustom:'#bsi_nav_liks',
controls:false
});
});
} else {
hide_side_trig = 0;
$(".users_news, .boxes_news").removeClass("long");
$("#colum_left").animate({"width":"910px"}, function(){
$(".short_news").each(function(){
$(this).css({"width":"289px"});
});
$('.mas_news').masonry({
itemSelector: '.short_news',
singleMode: false,
isResizable: true,
"gutter": 20,
isAnimated: true,
animationOptions: {
queue: false,
duration: 500
}
});
$.cookie("hide_side", "2", {
expires : 360, //expires in 10 days
path : '/', //The value of the path attribute of the cookie
domian : 'mexalim.com.ua'
});
$('.boxes_slider').bxSlider({
slideSelector:'.boxes_slider_item',
pagerCustom:'#bsi_nav_liks',
controls:false
});
});
}
});
var hide_side = $.cookie("hide_side");
var hide_side = 1;
Answer the question
In order to leave comments, you need to log in
Well, remove the condition altogether
and just always do what's inside it if (hide_side == "1") {
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question