problema conditia if else
Forum gratuit: forum de suport al utilizatorilor :: Forum de suport :: Probleme legate de un script (cod) :: Arhiva scripturi/coduri
Pagina 2 din 2 • Distribuiţi
Pagina 2 din 2 • 1, 2
problema conditia if else
Rezumarea primului mesaj :
ce am gresit de nu merge ?
- Cod:
$(function(){
if ($("a#toggle_sidebar").length > 0) {
$('#toggle_sidebar').click(function() {
$('#dw_right').show();
$('#content-container div#container').css('width','83%');
});
}
else {
$('#toggle_sidebar').click(function() {
$('#dw_right').hide();
$('#content-container div#container').css('width','100%');
});
}
});
ce am gresit de nu merge ?
Ultima editare efectuata de catre VeteraNNN in Sam Feb 02, 2013 5:53 pm, editata de 1 ori
VeteraNNN- Membru activ
- Mesaje : 484
Varsta : 30
Localizare : Undeva in spatele tau !!
Data înscrierii : 28/10/2012
Mulțumiri : 0
Re: problema conditia if else
CSS:
- Cod:
#content-container div#container { width: 83% !important;}
- Cod:
$(function(e) {
$('#content-container div#container').after('<a id="toggle_sidebar" class="toggle_sidebar2" data-closed="«" data-open="×" onclick="">×</a><div id="dw_right"><ul class="dwtheme">
<li>phpBB3 - Theme</li>
<li id="id-1"> <a href="/t14-carbon-blue" id="carbon_blue">1. Carbon Blue</a><span id="views"></span></li>
<li id="id-2"> <a href="/t34-overlay-bluberry">2. Overlay Bluberry</a><span id="views"></span></li>
<li id="id-3"> <a href="/t31-uniform">3. Uniform</a><span id="views"></span></li>
<li id="id-4"> <a href="/t5-ip-board-default">4. IP. Board Default</a><span id="views"></span></li>
<li id="id-5"> <a href="/t21-es-blue-v1">5. ES Blue v1</a><span id="views"></span></li>
<li id="id-6"> <a href="/t96-photoshop-glosy">6. PhotoShop Glosy</a><span id="views"></span></li>
<li id="id-7"> <a href="/t50-uniform-blue">7. Uniform Blue</a><span id="views"></span></li>
<li id="id-8"> <a href="/t4-blue-sensivity">8. Blue Sensivity</a><span id="views"></span></li>
<li id="id-8"> <a href="/t51-proglass">9. proglass</a><span id="views"></span></li>
<li id="id-10"> <a href="/t133-kevin-cods-v1#406">10. Kevin-Cods v1</a><span id="views"></span></li>
</ul>
<br />
<ul class="dwtheme">
<li>punBB - Theme</li>
<li id="id-1"> <a href="/t16-blue-white">1. Blue White</a><span id="views"></span></li>
<li id="id-10"> <a href="/t89-anonymous">2. Anonymous</a><span id="views"></span></li>
</ul>
<br />
<ul class="dwtheme">
<li>Premium - Theme</li>
<li id="id-1"> <a href="/t102-premium-final-supernova-blue">1. Supernova Blue [Price]</a><span id="views"></span></li>
<li id="id-10"> <a href="/t75-premium-navia">2. Navia [Free]</a><span id="views"></span></li>
</ul>
<br />
<ul class="dwtheme">
<li>Last Members Online</li>
<li id="latest_online_members"></li>
</ul>
<br />
<ul class="dwtheme">
<li>Online Staff</li>
<li id="staff"><img src="http://ipbforumskins.com/skindemo/public/style_images/wireless/post_offline.png" alt="" class="post_online" data-tooltip="Offline" id="anonymous_element_5"> <i>Not new online staff</i></li>
</ul>
<br />
<ul class="dwtheme">
<li>Statistics</li>
<li id="id-1">Total Topic: <span id="dw_topic"></span></li>
<li id="id-2">Total Post: <span id="dw_post"></span></li>
<li id="id-3">Total User: <span id="dw_user"></span></li>
<li id="id-10">Most Online: <span id="dw_online"></span></li>
</ul>
<style>.dwtheme li:nth-child(1) {
background: url("http://i48.servimg.com/u/f48/17/48/49/15/highli19.png") repeat-x scroll 0 0 #EEE;
border: 1px solid #D8D8D8;
clear: both;
margin-left: -6px;
margin-right: -6px;
padding: 5px 8px;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
position: relative;
top: -6px;
}
.dwtheme {
background: whiteSmoke;
border: 1px solid #DDD;
width: 190px;
padding: 5px;
margin-left: 10px;
margin-top: 16px;
}
#id-1, #id-2, #id-3, #id-4, #id-5, #id-6, #id-7, #id-8 {
padding: 0 0 6px;
border-bottom: 1px solid #CCC;
margin-bottom: 5px;
}
#id-9, #id-10 {
padding: 0 0;
margin-bottom: 2px;
}
.dwtheme #views {
float: right;
}
div#dw_right {
display: block;
}
#dw_topic, #dw_post, #dw_user, #dw_online {
padding-left: 5px;
}
#latest_online_members a span {
display: none;
}
#latest_online_members a img {
width: 30px;
margin-right: 7px;
height: 30px;
background: white;
padding: 1px;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.13);
margin-bottom: 5px;
}
#latest_online_members a span {
position: absolute;
margin-left: -45px;
margin-top: -20px;
background: #EEE;
padding: 2px 5px;
border: 1px solid;
}
#latest_online_members a:hover #latest_online_members a span {
display: block;
}
#latest_online_members {
margin-left: 14px;
}
#toggle_sidebar {
position: absolute;
right: 37px;
z-index: 8000;
background: #1988C7;
padding: 3px 7px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
color: white;
opacity: 0.1;
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
}
#toggle_sidebar:hover {
opacity: 1;
}
</style></div>');
});
$(function() {
$('#variables strong:eq(0)').clone().appendTo('#dw_topic');
$('#variables strong:eq(1)').clone().appendTo('#dw_post');
$('#variables strong:eq(2)').clone().appendTo('#dw_user');
$('#variables strong:eq(3)').clone().appendTo('#dw_online');
$('#latest_online_members').load('/memberlist #memberlist .avatar-mini a:lt(8)');
});
$(function () {
$('a.toggle_sidebar2').click(function () {
$('#dw_right').css('display', 'none');
$('#content-container div#container').css('width', '100%');
});
$('#toggle_sidebar').click(function () {
$('#dw_right').css('display', 'block');
$('#content-container div#container').css('width', '83%');
});
});
Re: problema conditia if else
- Cod:
$(function () {
$('a.toggle_sidebar2').click(function () {
$('#dw_right').css('display', 'none');
$('#content-container div#container').css('width', '100%');
});
$('#toggle_sidebar').click(function () {
$('#dw_right').css('display', 'block');
$('#content-container div#container').css('width', '83%');
});
});
acest cod nu va functiona din cauza asta :
pentru ca ar fi trebuit ceva de genu:
- Cod:
var x = document.getTagById("id");
if(x conditie) {
$('#toggle_sidebar').addClass('nume');
$('#toggle_sidebar.nume').click(function () {
$('#dw_right').css('display', 'none');
$('#content-container div#container').css('width', '100%');
});
}
else {
$('#toggle_sidebar.nume').removeClass('nume').addClass('active');
$('#toggle_sidebar.active').click(function () {
$('#dw_right').css('display', 'block');
$('#content-container div#container').css('width', '83%');
});
}
PS: am facut al cod dar aceiasi problema
- Cod:
$(function() {
var z=document.getElementById('dw_right');
var c=document.getElementById('container');
});
function dwhide() {
if($(x).length>0) {
x.style.display='none';
c.style.width='100%';
}
if else($(c).length>1) {
x.style.display='inline';
c.style.width='83%';
}
else {
x.style.display='none';
c.style.width='100%';
}
}
VeteraNNN- Membru activ
- Mesaje : 484
Varsta : 30
Localizare : Undeva in spatele tau !!
Data înscrierii : 28/10/2012
Mulțumiri : 0
Re: problema conditia if else
Topicul a fost marcat ca fiind rezolvat, deci il voi trimite in arhiva.
Adi.- Membru onorific
- Mesaje : 3738
Localizare : Forumgratuit
Data înscrierii : 01/08/2012
Mulțumiri : 30
Pagina 2 din 2 • 1, 2
Subiecte similare
» Problema cod
» problema pagina de start problema grup problema avatar
» Problema CSS
» Problema
» Problema
» problema pagina de start problema grup problema avatar
» Problema CSS
» Problema
» Problema
Forum gratuit: forum de suport al utilizatorilor :: Forum de suport :: Probleme legate de un script (cod) :: Arhiva scripturi/coduri
Pagina 2 din 2
Permisiunile acestui forum:
Nu puteti raspunde la subiectele acestui forum