These are chat archives for codefellows/sea-c16-javascript

24th
Jul 2014
Ivan Storck
@ivanoats
Jul 24 2014 00:39
@joeelsey Completely
Jarrod Medrano - Front-End UI Developer Seattle
@jmedran
Jul 24 2014 02:03
whats the door code?
Mandi Grant
@MJGrant
Jul 24 2014 02:08
What;s the door pass code?
A couple of us are stuck out here
Joaquin Guardado
@macikokoro
Jul 24 2014 02:59
This message was deleted
Stephanie Lingwood
@stephanielingwood
Jul 24 2014 07:19
I'm looking for some jQuery syntax help (the interwebs haven't been all that helpful). Here's what I want to do: On line 6, I want to assign to a variable the child class name for an element with the parent class of .tabs. Then, on line 11, I want to refer to that class name as the child class of an element with the parent class of .tab-content. Any ideas? $(document).ready(function() { $('#show-tab').addClass('active-tab'); $('#show-content').addClass('active-content'); $('.tabs').on('click', function() { var selected = $(this).attr('.tabs > class'); $('.tab-text').fadeOut('slow'); $('.tab-content').removeClass('active-content'); $('.tabs').removeClass('active-tab'); $('this').addClass('active-tab'); $('.tab-content' + '.' + selected).fadeIn('slow'); console.log(selected); }); });
Stephanie Lingwood
@stephanielingwood
Jul 24 2014 07:26
$(document).ready(function() { $('#show-tab').addClass('active-tab'); $('#show-content').addClass('active-content'); $('.tabs').on('click', function() { var selected = $(this).attr('.tabs > class'); $('.tab-text').fadeOut('slow'); $('.tab-content').removeClass('active-content'); $('.tabs').removeClass('active-tab'); $('this').addClass('active-tab'); $('.tab-content' + '.' + selected).fadeIn('slow'); console.log(selected); }); });
Hunh...wrapped it in backticks both times and it's still coming out weird. (Feel free to delete the second post...I can't seem to do that.)
This message was deleted
Stephanie Lingwood
@stephanielingwood
Jul 24 2014 07:35
This message was deleted
Martin Genev
@mgenev
Jul 24 2014 16:34
not sure if you guys noticed this, but here is a much more expanded series of lectures on yesterday's topic https://www.youtube.com/playlist?list=PLB_QFf1fzn9OVZHWCwf6NkXpkI55LXsRk
Walker
@walkermalling
Jul 24 2014 18:02
This message was deleted

@stephanielingwood It looks like you're passing the wrong argument to

var selected = $(this).attr('.tabs > class');

The .attr() method should take one of the elements attributes

So here:

<a href="mydomain.com" class="myclass" id="primary-link">something</a>

The attributes of the anchor tag are "href","class" and "id".

CTownsdin
@CTownsdin
Jul 24 2014 19:54
is there an easy way to make lodash work in the repl?
Hank Yates
@hankyates
Jul 24 2014 19:54
in node?
go to lodash.com and open dev tools
_ is in the global scope on lodash.com
CTownsdin
@CTownsdin
Jul 24 2014 19:55
can it be used in just (chrome, ctrl-shift-j) ?
or only in node, or both?
Hank Yates
@hankyates
Jul 24 2014 19:56
yeah ctrl+shift-j opens dev tools
CTownsdin
@CTownsdin
Jul 24 2014 19:57
hmmm, I think I see... lodash needs to be loaded as a script in whatever webpage you are using to get to the dev tools on? is that correct?
well, it works on lodash.com's dev tools anyway, that's what I was looking for, thank you!
Stephanie Lingwood
@stephanielingwood
Jul 24 2014 20:00
@walkermalling thanks for the reply. And sorry if I wasn't clear in my post last night - my brain was toasted. Anyway, if I write it like this - .attr('class') - it only gets the parent class. The particular element I'm targeting has two classes; the class assigned to the list it's in (.tabs), and the class assigned to this element and one other (.tab1). I'm trying to get it to find the .tab 1 class, so I can assign that .tab1 class to a variable I can refer to later.
Hank Yates
@hankyates
Jul 24 2014 20:22
@CTownsdin right the lodash website loads the library to the global scope of your browser which is why its available when you open dev tools
Walker
@walkermalling
Jul 24 2014 20:58
@hankyates
Whats going on with bitwise shifting (e.g. the << operator) as seen here
Hank Yates
@hankyates
Jul 24 2014 20:58
The shift operators >> and << are equivalent to divide by 2 and multiply by 2 respectively.
bitwise stuff can be a bit funky
the most common one you see is ~~ which is used as a faster Math.floor
CTownsdin
@CTownsdin
Jul 24 2014 22:18
hank you around?
Hank Yates
@hankyates
Jul 24 2014 22:19
im usually on and off
CTownsdin
@CTownsdin
Jul 24 2014 22:20
going to pm ya
Hank Yates
@hankyates
Jul 24 2014 22:20
kk