DataStream
Member
Why did you choose Vue instead of Preact? Or were you not invested in React?
The project was really just getting started and we liked the way Vue has been progressing.
Why did you choose Vue instead of Preact? Or were you not invested in React?
There are things that matter because they lead to bugs (that's why linters are a very good idea for languages like Javascript), and there are things like this. All it does is annoy me.
#0000 may be a bug, #FFF clearly isn't. It's equally good as #ffffff.
And I can't even tell stylelint to accept both, it's one or the other.
No, see, I actually love linters, and I've spent an absurd amount of time configuring ESLint to my maximum pleasure.It's just that... at some point you just have to ask yourself if the 120 different rules regarding bracket positioning and spacing are actually worth it.just to find out most of my style preferences are the complete opposite of what my new job use :'(
<script>
function setBNP(operationalEntity){
var countryImg = document.getElementById("atmbanklogo");
var operEn = document.getElementById("operational-entity");
countryImg.src = "/ca/en/images/14/05/bnp.png";
operEn.innerHTML(operationalEntity);
}
</script>
<a href="#wheretobank" onclick="setBNP('BNP Paribas El Djazair'); return false;">Algeria</a>
<div id="wheretobank">
<img id="atmbanklogo" src="/common/banners/logo.png" /><br/><br/>
<p id="operational-entity"></p>
</div>
operEn.innerHTML = operationalEntity;
wtf is wrong with me, of course- thanks.
https://www.kickstarter.com/projects/232193852/font-awesome-5
Couple more days to get the pro license for a measley 20 bux.
Why would I as a developer pay for the icons the client wants.
20$ is a joke for all the icons of course, but I don't know for what I would need them for personally. Do you guys build your own products?
isn't the React license thing an unfounded fear?
Thread is for development and design, so presumably, yes some people may design in here for either their own products or others'.
Big company legal team feels otherwise
I'm a bit out of the loop in terms of web design, so I figured this is a good place to ask...
Are carousels in the hero sections of websites considered bad nowadays? Is it better to have one big image with some text & a button instead?
So... How's this thread feeling about the new MBP? I know it's been the go-to machine for a lot of front-end dev or UI devs (myself included), but...is it still? I feel like I've been holding out for this refresh but I see more reasons to look elsewhere than I do to stick around, although the comfort of having the native terminal apps and photoshop running alongside one another never really fades.
So... How's this thread feeling about the new MBP? I know it's been the go-to machine for a lot of front-end dev or UI devs (myself included), but...is it still? I feel like I've been holding out for this refresh but I see more reasons to look elsewhere than I do to stick around, although the comfort of having the native terminal apps and photoshop running alongside one another never really fades.
Ok, so... I was asked in an assignment for class that I need to list the type of tags used for certain functions in a list. The problem is, I can't remember how to write the code to display the html tags without it using them. How can I show the <nav></nav> tag for instance in my code to the end user without using the tag.
My code for example is supposed to look like
<ul>
<li> <!-- <div></div> would go here for instance--> </li>
</ul>
<ul>
<li> <div></div></li>
</ul>
Escape the greater than (> and less than (< symbols and wrap them inside <pre> for pretty formatting
Code:<ul> <li> <div></div></li> </ul>
There's also https://developer.mozilla.org/en-US/docs/Web/HTML/Element/xmp, but it's deprecated.
Awesome, I had figured out the special chars, but not the <pre> tag before you responded, I saw some info about using htmlentities() like so. Is this a better usage than special chars?
echo '<pre>';
echo htmlspecialchars($YOUR_HTML);
echo '</pre>';
Anyone know a good, comprehensive tutorial for making plug-ins in wordpress? I have an idea for my company's site, but I think I need to make what I need on my own.
It's about gathering my clients' needs and return a report. Not hard in theory but I want to learn how to do it without messing everything up.
Anyone know a good, comprehensive tutorial for making plug-ins in wordpress? I have an idea for my company's site, but I think I need to make what I need on my own.
It's about gathering my clients' needs and return a report. Not hard in theory but I want to learn how to do it without messing everything up.
<?php
function theme_enqueue_styles() {
wp_enqueue_style('parent-style', get_template_directory_uri() . '/style.css');
wp_enqueue_style('child-style', get_stylesheet_directory_uri() . '/style.css', array($parent_style));
}
add_action('wp_enqueue_scripts', 'theme_enqueue_styles');
/* Add your own functions below this line.
======================================== */
function wpb_adding_scripts() {
wp_register_script('smoothanchor', plugins_url('smoothanchor.js', __FILE__), array('jquery'),'1.1', true);
wp_enqueue_script('smoothanchor');
}
add_action( 'wp_enqueue_scripts', 'wpb_adding_scripts' );
wp_enqueue_script( 'smoothanchor', get_template_directory_uri() . '/js/smoothanchor.js', array( 'jquery' ), '', true );
$(function() {
$('a[href*="#"]:not([href="#"])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html, body').animate({
scrollTop: target.offset().top
}, 1000);
return false;
}
}
});
});
[B](function($) {[/B]
$(function() {
$('a[href*="#"]:not([href="#"])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html, body').animate({
scrollTop: target.offset().top
}, 1000);
return false;
}
}
});
});
[B]})( jQuery );[/B]
(function($) {
})( jQuery );
function wpb_adding_scripts() {
wp_register_script('smoothanchor', plugins_url('smoothanchor.js', __FILE__), array('jquery'),'1.1', true);
wp_enqueue_script('smoothanchor');
}
add_action( 'wp_enqueue_scripts', 'wpb_adding_scripts' );
wp_enqueue_script( 'smoothanchor', get_template_directory_uri() . '/js/smoothanchor.js', array( 'jquery' ), '', true );
WordPress runs jQuery in a no-conflict mode. Basically, it doesn't associate $ as jQuery, so you have to prepend your jQuery functions with:
Code:[B](function($) {[/B] $(function() { $('a[href*="#"]:not([href="#"])').click(function() { if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); if (target.length) { $('html, body').animate({ scrollTop: target.offset().top }, 1000); return false; } } }); }); [B]})( jQuery );[/B]
Sorry for the bad spacing.
Basically you're wrapping your jquery with a self-executing anonymous function:
Code:(function($) { })( jQuery );
Alternatively, you could instead replace every $ with jQuery in your code as well, but typically wrapping the whole thing in that function is easier.
Beyond that though this looks a little redundant or erroneous:
Code:function wpb_adding_scripts() { wp_register_script('smoothanchor', plugins_url('smoothanchor.js', __FILE__), array('jquery'),'1.1', true); wp_enqueue_script('smoothanchor'); } add_action( 'wp_enqueue_scripts', 'wpb_adding_scripts' ); wp_enqueue_script( 'smoothanchor', get_template_directory_uri() . '/js/smoothanchor.js', array( 'jquery' ), '', true );
In the top function, you're pointing to a plugins_url and looking for smoothanchor.js, but then in the wp_enqueue_Script at the bottom, you're pointing to your theme directory, then the js folder, and then smoothanchor.js.
I wonder if these are conflicting with one another. If you know where smoothanchor.js is and it's in your theme folder, then all you should need to do is the bottom wp_enqueue_script() function, not the top one. Enqueue scripts is WordPress' way of bringing a script into the template. This is definitely the preferred way, but you could also try removing it from functions.php and then calling your script the old fashioned way in the header.php file in your theme directory... Using <script src... />
Enqueuing your script as you have it in functions.php is the best way. I just wonder if that wpb_adding_scripts() function is mucking things up. Seems redundant to me.
Thank you for the insights, I tried just wrapping the script, modifying functions.php like you said, and using <script> in the header... nothing works.
I'm positive now that there must be some kind of osbcure conflict somewhere.
-Did you load jquery twice, or even two different versions?
-Is it really the body you need to scroll on?
-Can you add console.log('hi') in the click function, so you can see if the function even fires at all?
Uncaught SyntaxError: Unexpected token <
-I'm not sure I know what that means :/
-Pretty sure, yeah.
-I guess that's the first thing I should have done: look at the console. Not only the function doesn't start, I also get this error:
apparently it appears at the very beginning of the html (<!DOCTYPE html>), and it happens in every page.Code:Uncaught SyntaxError: Unexpected token <
Not sure what this means :/ sorry, again, I'm pretty new at this.
It means that your webserver is fetching a resource (such as an JavaScript file or PHP file) but failing to find it thus returning an HTML page instead (such as an error page, or index.php as it commonly occurs on Apache servers) which the browser tries to parse.
Go to your network tab in developer tools (usually F12, or CMD+J, or right click and select inspect page) and see the file that fails to load correctly.
Finally finished my company's website and installed a ServiceWorker for offline viewing. It only works half the time though and seems to fail fetching the assets way too often. Any idea what's going on?
The entire website is only 10.7MB so it shouldn't be the internet causing problem for downloading such a large site.
EDIT - Totally different question. My company is going to start a project and I'm in charge of the entire front-end stack. Any way to go about looking at the best options? I'm just leaning towards using Angular 2 for it since I'm not entirely sure how other technologies stack up to each other. The backend seems to be going MySQL and CakePHP
So, a friend of mine is launching a weblog and asked my help to convert his design to wordpress.
I'm stuck. I have no idea how to do the 4 column new entries/post thing I'm desperate.
Any help will be really appreciated.
while ( have_posts() ) : the_post();
<div class="col-xs-12 col-sm-6 col-md-3">
<div class="blog-item">
<p><?php the_post_thumbnail(); // this gets your featured image and makes it a thumbnail ?></p>
<h3><a href="<?php the_permalink(); // returns the link to your post ?>"><?php the_title(); // this prints out the title to your post ?></a></h3>
<p><?php the_excerpt(): // this returns a post excerpt for each post, or the first ~180 characters of the post ?></p>
</div>
</div>
We're working on tables and I'm having trouble figuring out why my column will not align like my one below. I'd appreciate it if someone could steer me in the right direction.