Jump to content
php.lv forumi

jQuery: fadeIn nedarbojas


Recommended Posts

Posted

Sveiki,

Esmu iesācējs jQ. Nekādīgi netieku gudrs, kāpēc skriptiņš nedarbojas... =( Ceru uz palīdzību. =)

 

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="Text/HTML; Charset=UTF-8" />

	<title>Bliss</title>

	<script type="text/javascript" src="./javascripts/jquery-1.4.4.min.js"></script>

	<script type="text/javascript">
		<!--

			$(document).ready(function(){

				$("input#remember_me").click(function(event){

					$("p#shared_computer").fadeIn("slow");

				});

			});

		//-->
	</script>


	<link href="./themes/default/style.css" type="text/css" rel="stylesheet" media="all" />
</head>
<body>



<form method="post" action="do__sign-in.php">
	<p><label>Username: <input name="username" /></label> <strong>(*)</strong></p>

	<p><label>Password: <input name="password" type="password" /></label> <strong>(*)</strong></p>
	<p><label><input id="remember_me" name="remember_me" type="checkbox" /> Remember me!</label></p>
	<p id="shared_computer" class="small">[ Not recommended on a shared computer! ]</p>

	<p><input type="submit" value="Submit!" /></p>
</form>


</body>
</html>

Posted (edited)

Ir kādas kļūdas, kas lec laukā javascript konsolē? Vajadzētu strādāt, imo..

 

Gribētu ieteikt šādu js kodu likt htmlam apakšā.

 

 

Pamēģini šo:

 

$(document).ready(function(){
alert('Mēs esam te');
$("input#remember_me").change(function(){
	alert('Tagad esam te');
	if($(this).is(":visible")){
		$("p#shared_computer").fadeOut("slow");
	}else{
		$("p#shared_computer").fadeIn("slow");
	}
});
});

Edited by briedis
Posted

Manam kodam lec ārā...

 

Warning: Unexpected token in attribute selector: '!'.
Source File: http://localhost/bliss/sign-in.php
Line: 0

Posted

Tavs kods darbojās. Vismaz alert'i. Kaut ko fade'oja, kaut ko nē... =( Varbūt CSS pie vainas...

 

p#shared_computer {

padding: 5px 0;
visibility: hidden;

}

Posted

Nu ja būtu tik vienkārši. Bet tur nav nevienas "!" zīmes, ja neskaita "<!--", ko izņemot tāpat nekas nemainās. =(

Posted

visibility:hidden nevar iefeidot, jābūt display:none;

ja jāizmanto visibility, tad $(el).css({opacity:0,visibility:'visible'}).animate({opacity:1});

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...