-
Posts
5,717 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Adam
-
Okay, you just need to add an additional header after these: $headers = "From: " . $from_email; $headers .= PHP_EOL; $headers .= "Reply-To: " . $_REQUEST['email']; Instead of "Reply-To" or "From" though, you need to use "Bcc". Don't forget to split the headers up with a line-break, although I wouldn't recommend using PHP_EOL like you have now. I would use "\r\n".
-
You need to add an additional BCC header; take a look at the fourth mail parameter. Please post the whole code if you need any more help, what you posted previously is just a variable declaration.
-
Why are you calling load() on a DIV element? Only the window object has a load event: $(window).load(function(){ Edit Although it's worth mentioning, there's no need to wait for the window to finish loading to do what you want. You may as well start binding as soon as the document is 'ready': $(document).ready(function(){
-
I'm not trying to be awkward or anything by the way. I work with UX designers every day and they point out seemingly minor issues like this all the time. When it comes to form controls especially, just stick with the browser default behaviours. Don't try to mimic or fake anything that isn't meant to happen, because you will just introduce a host of accessibility issues that will inevitably annoy someone.
-
The main problem with that is that you loose the kind of responsive positioning that the browser provides. For example when you have wide options and the drop down is near the bottom right of the screen, the browser will position and size it so it's always in view. You could obviously implement that yourself, but it would be a lot of effort for something so trivial. You'll also have cross-browser issues and the like to consider. The other problem with that is that when the options are showing, clicking outside of the menu doesn't hide it. So you've got accessibility issues to consider. Wouldn't be too difficult to get it working, but again this is all a lot of effort for something that isn't strictly needed.
-
No you had it right the first time, the load event belongs to the window.
-
No.. it won't. Have you tried it?
-
You're just triggering the DOM click event, you're not triggering the browser's native behaviour for a click.
-
Do you have a link to the documentation you're following? After a 30 second look on Google I can only see a like button script.
-
I suspect the OP wants to mimic a user physically clicking the drop-down to show the options, but not actually selecting one. I can't see this being possible to be honest. The browser won't expose an API that controls that kind of behaviour, and there's no way of faking a native event to trigger it. It has to be the user that selects it. You could of course just set focus() to it with some very obvious styling to show that it has focus, but that's about it. If you want it really bad you could create your own version of the select, but then you start running into usability issues. It annoys the hell out of me when a website has implemented their own fancy looking drop-downs which completely break keyboard control. I'm quite intrigued to know why a user clicking a button needs to do this? Why not just have them click the drop-down in the first place?
-
You can't beat Chrome's debugging tools in my opinion. Took me a while to make the move, but I wouldn't go back now
-
As I said, the browser won't let you enter full-screen mode without the user triggering it themselves (which is a really good thing). You'll need to have a button or something to trigger it.
-
In vim, just select the text and press "="
-
I imagine something as intrusive as full-screen mode would require a user action before the browser will permit it. Try applying your code to a click event and see if that works.
-
This isn't really a JS issue it's just CSS, so I've moved it to the CSS forum. Take a look into the display property. In your case you could just add display: inline-block to a <span>, and I think it should do what you're after. Just note that to reliably use inline-block on older versions of IE you must apply it to elements that are naturally inline displayed (spans, strong, em, etc.) http://jsfiddle.net/GZcWm/
-
This topic has been moved to CSS Help. http://forums.phpfreaks.com/index.php?topic=363968.0
-
I've not used Backbone before, but looking at the documentation you don't pass in the el property there. Backbone.View.Extend returns a prototype, that you can then construct with the element: var HomeView = Backbone.View.Extend({ ... }); var home_view = new HomeView({el: '...'});
-
I'm saying, you don't need to put any jQuery code in document ready. Unlike what you said: Nor am I saying it's a bad thing to do.. Let's just let the argument rest ---- I don't... what? Why is that better? Why not just define it normally?
-
I'm not on about the function definitions..
-
You will only run into problems if you try to access DOM elements that don't exist yet. It's pretty common to put your "main" JS file within the foot of the document though, and just execute the code there and then (sometimes with a closure around jQuery), outside of any ready event. I'm not saying you shouldn't put your code within the document ready event, I'm saying it's not a requirement, so you shouldn't tell people it is. An by using it somewhere else I was thinking more in terms of modular JS, or general objects where you pass in jQuery as a dependency. ---- Lumping everything into a document ready event is not organised, it's just going to get messy and a pain to maintain if you write enough code. If you really want to do it right, take a look at RequireJS and modular JS that I alluded to above.
-
To answer your original question mrbean, the code within the document ready event is wrapped in an "anonymous" function. Essentially it's just a nameless function, but you're still within the context of a function. In JS you can define 'private' functions within functions, but they're limited to the parent function's scope. So when you define test() within document event, you're restricting it to just that anonymous function. If you were to define it out of the document ready event and in the global scope, it would be accessible anywhere. @jesirose Why shouldn't you use jQuery outside of the document ready event? There's good and bad ways of doing it of course, but if you're using jQuery as your JS framework then it's pretty unavoidable that you're going to need it somewhere else. @ChristianF Calm down man. The OP came here asking about function scope, I'm sure he just got a little confused with the response about including stuff.
-
They're two separate events. When they're fired they make their way up the DOM tree individually. If you changed the checkbox to a 'click' event, it would work. Of course though that wouldn't work if you changed the value of it using the keyboard. I would just detect the origin element in the event object, and conditionally run the 'click' event's code if it's not the input.
-
Well blocks of content are traditionally entered using a WYSIWYG editor. The header and footer though would need to be more controlled, given that anyway who doesn't know what they're doing could completely destroy the website. You don't really need to worry about proving a way to edit the templates, no one that isn't a dev should be able to go in and change the HTML, and the dev can do that in the file as usual.
-
What you're asking to do doesn't make any sense. Why would you want to refer to the image by it's src of test01.png, when you know you can access it through image[1]? Sounds like you're trying to over complicate things. If in your actual code you're not using numeric values like that though, you could just use a standard object instead: function createImage(src) { var image = new Image(); image.src = src; return image; } var images = { '/path/to/foo.png': createImage('/path/to/foo.png'), '/path/to/bar.png': createImage('/path/to/bar.png'), '/path/to/baz.png': createImage('/path/to/baz.png') } console.log(images); console.log(images['/path/to/foo.png']); console.log(images['/path/to/bar.png']); console.log(images['/path/to/baz.png']); http://jsfiddle.net/UQHey/ If that is the case though you should have posted your code, or mentioned you're not using sequential naming like that.
-
Best way to manage language change on a static website
Adam replied to Ricky55's topic in Miscellaneous
Why? That just adds an overhead to the native language and forces you to define two uniques for each translation.