Solved

jquery bind in click function?

Posted on 2012-04-08
4
333 Views
Last Modified: 2012-05-09
Hello Experts,

I am sure the below code is fairly simple.
all i am trying to do is to bind the 1st and the 2nd click events because at the moment the slide (#ausstattungs-container) is showing bouncing  twice.

Please help!


$(document).ready(function() {
	
	$('table tr').click(function() {
		
		var firstTd = $('.tdlight:first', $(this));
		if (firstTd.length == 0)
			return;	
		
		var text = firstTd.text();
		
		$('#sliderClick').click(function() {
		$('#ausstattungs-container').show("slide", { direction: "right" }, 1000);
		$('#we'+text).show();
		});
	});	
});

Open in new window

0
Comment
Question by:Refael
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 

Author Comment

by:Refael
ID: 37821944
This is actually not a bind problem.

this cause the problem

.show("slide", { direction: "right" }, 1000);

Open in new window


When i use
.slideDown();

Open in new window


It works fine!

so how can i use "slide to right "?
0
 
LVL 6

Accepted Solution

by:
jjperezaguinaga earned 500 total points
ID: 37822580
Greetings Refael,

Docs are your friend! http://docs.jquery.com/UI/Effects/Slide

Make sure you are using UI and importing the last version of jQuery, since the first line should work :)

As a last resource, you can use the css property margin-left: Xpx with animation, or the css property left, in case your div is position: absolute. I still stand by my statement, pretty sure the code works, you just need to import jQuery UI and the latest version of jQuery.

Cheers!
-JJ
0
 

Author Comment

by:Refael
ID: 37823014
Hi jjperezaguinaga,

It works but ... as i said above the slider seem double bounce/slide.
0
 
LVL 6

Expert Comment

by:jjperezaguinaga
ID: 37823704
Oh, that's weird.

Can you confirm that your html markup is like the following?
http://jsfiddle.net/yJ72f/
0

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are a couple ways to attach a JavaScript function to dynamically created elements. You can make a new script for each element as it’s created or you can use delegation. Delegation allows a single script that is added at page creation to mat…
Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question