Wynn
Members
-
Joined
-
Last visited
Solutions
-
Wynn's post in TD Input check was marked as the answer$.val() when applied to a collection will only return the value of the first element.
To check all the values you'll have to iterate through each input or filter them.
if ($('input:text').filter(function() { return this.value.trim() === ""; }).length > 0) { alert("empty") } else { alert("Not empty") } -
Wynn's post in Floating & Expanding Div -CSS/HTML was marked as the answerIt's a fixed positioned link which is then translated, on it's X axis, off page until it's icon is hovered over.
quick examples:
left-hand side
https://jsfiddle.net/76vdLxos/1
right-hand side
https://jsfiddle.net/76vdLxos/
-
Wynn's post in Sum input values only if checkbox is checked was marked as the answerThe problem is that both your conditionals always return true, you can test this by logging something to the console in your second if statement.
So sum will always equal sumCheckbox + sumRadio, however if you only check one type of input the other will return NaN which is why you're getting the error.
You'd need to check the length property on the jQuery objects, or use $('input[type=checkbox]).is(':checked')..
..or you could just get rid of the conditionals altogether and just use a default value of 0.
$('.signup input').on('change', function () { var sumRadio = parseInt($('input[name="sits_count"]:checked').val()) || 0; var sumCheckbox = parseInt($('input[name="avia-transfer"]:checked').val()) || 0; var sum = sumCheckbox + sumRadio; $('.sum').html('<b>Сумма:</b> ' + sum + ' руб.'); }); -
Wynn's post in Search form on plain javascript was marked as the answerfleur, querySelectorAll returns a nodeList not an Array. You can't use Array methods on a nodeList you first need to convert it into an Array.
Array.prototype.slice.call(document.querySelectorAll('.text_blocks')); $.filter is different as it's a custom function designed to work on any collection.
I'm not sure what your HTML structure is. You say you're working with divs not a list, but your jQuery is filtering a list?
Anyway, I typed this out, maybe it'll help.
http://jsfiddle.net/p5f7vjfu/
-
Wynn's post in Split and loop in array was marked as the answer(function ($) { var splitText = $('#random').text().split(""); // splitText is an Array of Strings. /** / Iterate through Array, wrap each String in a span / and append to #result. */ splitText.forEach(function (ltr) { $('<span/>', { text: ltr }).appendTo($('#result')); }); function run(i) { $('#result span').removeClass('red').eq(i).addClass('red'); setTimeout(function () { run(i += 1); }, 1000); } run(0); })(jQuery); http://jsfiddle.net/60zm48gd/
-
Wynn's post in jQuery .wrapAll on window resize issue was marked as the answerNot sure if this is what your after, but..
http://jsfiddle.net/Lafugxaw/
I refactored your code slightly, to get rid of the for loops, and the $.function should be re-usable should you need it again.
-
Wynn's post in Spacebar won't fast scroll was marked as the answerIt may be due to the fadeSlideShow plugin, it binds the spacebar to an autoplay function. You'll notice the images at the top stop when you press the spacebar. You can turn off keyboard control in the options.
jQuery(document).ready(function(){ jQuery('#slideshow').fadeSlideShow({ width: 934, height: 340, allowKeyboardCtrl: false // <- insert this line }); }); -
Wynn's post in Trigger auto height blocks in page scrolling was marked as the answerIf you console.log the values of pos and window.scrollTop you'll notice sometimes the offset().top of the current section returns a value fractionally greater than window.scrollTop by 0.nth of a pixel causing the code not to scroll to the next section.
So the code is working but just not as you'd expect.
If you use Math.floor it should remove the difference.
var pos = Math.floor($(this).offset().top); -
Wynn's post in stop opacity to embedded video was marked as the answerRemove the opacity and use a rgba background value instead, ie. rgba(0, 0, 0, 0.8 ) ;
-
Wynn's post in Text width to fill LI was marked as the answerTry this https://github.com/zachleat/BigText
Example
http://jsfiddle.net/9n2p6htt/
-
Wynn's post in clearInterval don't working was marked as the answerTry this
http://jsfiddle.net/Lr2oqsy7/
-
Wynn's post in YOU are the answer! was marked as the answerForget the button..
<i class="fa fa-volume-up" onclick="document.getElementById('non').play()"></i> You may want to add this in your CSS to show that it's clickable
i.fa-volume-up { cursor: pointer; }
-
Wynn's post in JS pass argument AND event handler to function was marked as the answerHi Nillervision,
Is this any help?
http://jsfiddle.net/pcxjabh8/
-
Wynn's post in How I make to this web site? (Fully as coded and designed) was marked as the answerThat's a really nice site. The tools used to create it are simple to use, but putting it all together is something else.
They're making good use of Skrollr and Transit
The landscape / garden effect at the top and bottom of the page are .png images stacked on top of each other moving at different speeds on scroll.
The vector graphics that are animated are .svg files created in Illustrator.
These again, are animated as you scroll down the page. (very basic example of svg animation with Skrollr).
The portfolio pieces are just video files.
Take a look at these..
http://css-tricks.com/svg-line-animation-works/
http://24ways.org/2013/animating-vectors-with-svg/
..and do a search for svg animation and parallax effects.
Good luck.
-
Wynn's post in CSS 3 Rounded Corners with <a> links, main div? was marked as the answerHi kevosoup,
You just need to set the overflow to hidden when adding a border-radius to .nav
Here's an example
-
Wynn's post in Max width/Min width issues on inline-block elements was marked as the answerFloated elements take on a computed value of display: block, so your inline-block on .contents is redundant and it's probably not acting as you expect.
http://www.w3.org/TR/CSS2/visuren.html#dis-pos-flo
So as a float is set to display block it will always take on the max-width value because its default is 100%.
Also see http://stackoverflow.com/questions/5331882/inline-block-min-max-width-behavior.
Inline-block elements are a little strange, they always produce a small gap (around 5px) on the right of the element. This is caused by the line-break in your html, it's not a margin and the only way to get rid is to inline your code, eg
<div class="contents"> .... .... </div><aside> ... ... </aside> you need to account for this small gap when positioning.
Personally I'd just stick with floats and use percentages for values.
Not sure that helps.
-
Wynn's post in jquery validation plugin issue was marked as the answerYou're calling Jquery twice, 1st at the top of page then at the bottom.
Remove the top instance and move the validator plugin to the bottom (after Jquery).
What's happening is:
1. You load Jquery (top of page).
2. You're extending this Jquery with the plugin.
3. You're over writing the above with the second call to Jquery.
-
Wynn's post in Replacing rel with class was marked as the answerYou could use the data attribute instead of class
here's a link to a solution
Slimbox2 & HTML5
-
Wynn's post in I need Help! I need a simple calculator for my website! was marked as the answerI've played around with the JS to try to make it a little cleaner.
You should be able to just keep adding different options as needed to your HTML.
Just make sure the checkboxes have a class of myChk and the select have a class of sel
I've also wrapped the whole lot in a form tag with the ID "quote"
<form id="quote"> <p>Option 1 <select class="sel"> <option value="0"> 0 </option> <option value="10"> 1 </option> <option value="20"> 2 </option> <option value="30"> 3 </option> <option value="40"> 4 </option> <option value="50"> 5 </option> </select></p> <p>Option 2 <select class="sel"> <option value="0"> 0 </option> <option value="10"> 1 </option> <option value="20"> 2 </option> <option value="30"> 3 </option> <option value="40"> 4 </option> <option value="50"> 5 </option> </select></p> <p>Option 3 <select class="sel"> <option value="0"> 0 </option> <option value="10"> 1 </option> <option value="20"> 2 </option> <option value="30"> 3 </option> <option value="40"> 4 </option> <option value="50"> 5 </option> </select></p> <p>Option 4 (+ 25) <input type="checkbox" value="25" class="myChk" /> </p> <p>Option 5 (+ 25) <input type="checkbox" value="25" class="myChk" /> </p> <p>Option 6 (+ 50) <input type="checkbox" value="50" class="myChk" /> </p> <p>Option 7 (+ 75) <input type="checkbox" value="75" class="myChk" /> </p> <p>Total: <span id="total"> 0 </span></p> </form> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script> $('#quote input').prop('checked',false); // Reset checkboxes and select $('#quote select').prop('selectedIndex',0); // on reload, delete if not needed $(function() { $('#quote input , #quote select').on('change', function() { var total = 0; $('.sel , .myChk:checked').each(function(){ total += parseInt($(this).val()); }); $('#total').text(total); }); }); </script> </body> </html> -
Wynn's post in semi-transparent background was marked as the answerBy using a rgba colour value instead of a Hex value.
For instance, for a semi transparent blue..
div { background : rgba( 0, 0, 255, 0.5) }
However IE8 and below wont like this (no surprise there), so you'll need to add a fallback.
This article will explain in more detail..
css-tricks [dot] com/rgba-browser-support/
-
Wynn's post in SASS Profound Grid was marked as the answerOk, I understand now.
In your first post you mention you're using compass, so I assume you've run
gem install compass
If not I suggest you do so, even if you don't use everything compass has to offer, it watches your files better than plain sass.
Next, if your creating a new project you run
compass create yourproject
or for an existing project
cd yourproject
compass init
This will create a directory structure similar to this:
yourproject
- config[dot]rb
- stylesheets
-print[dot]css
-screen[dot]css
-IE[dot]css
-sass
-print[dot]scss
-screen[dot]scss
-IE[dot]scss
you can delete the print, screen and IE stylesheets if you wish.
Create or place any scss files in your sass folder and compass,when run, will create the css files needed in stylesheets.
You can change the directory for your css files in config[dot]rb
once your all setup run
compass watch
and compass will listen for any changes in your sass folder.
If you don't want to use compass and its helpers.
you can tell sass to watch a whole directory by
sass --watch path/to/sass : path/to/css