I’m trying to target the scroll event for both the window and scrollable divs. Is there a way to do this in one statement? I’ve tried… Only way I have found is calling them both separately… Answer There may be a better way to do this, but you could use $.map to create a jquery object with both window and
Jquery form submission not being triggered
I’m new to JavaScript. I have been trying to design some code which geocodes a location when a search button is hit and the submits the form if successful. To make it to slightly more complicated, if an option from the autosuggest is selected, it also geocodes it even before the search button is hit. This all seems to work,
How to scroll down with Phantomjs to load dynamic content
I am trying to scrape links from a page that generates content dynamically as the user scroll down to the bottom (infinite scrolling). I have tried doing different things with Phantomjs but not able to gather links beyond first page. Let say the element at the bottom which loads content has class .has-more-items. It is available until final content is
Dynamically load google fonts after page has loaded
I would like to be able to have the user select which font they would like the page to be displayed in. Here is the way that Google recommends you do it using JavaScript. How can I modify this so that I can re-get fonts after the page has loaded? Answer Check out the WebFont.load command in this github repo:
How to create empty 2d array in javascript?
How do I create an empty 2D array in Javascript (without knowing how many rows or columns there will be in the new array)? If it’s a simple array var newArray = new Array(); I can assign as many elements as I want. But what about a 2D array? Can I create one without specifying the numbers of rows and
How can I set Image source with base64
I want to set the Image source to a base64 source but it does not work: JSfiddle.net/NT9KB the JavaScript Answer Remove the line-breaks in the base64:
Check if localStorage is available
I know there has been many questions about checking for localStorage but what if someone manually shuts it off in their browser? Here’s the code I’m using to check: Simple function and it works. But if I go into my Chrome settings and choose the option “Don’t Save Data” (I don’t remember exactly what it’s called), when I try to
OnClick thumbnails – load image
I have a simple image gallery of about 25-30 photos with a thumbnails strip What i want is to load only the image that i click the thumbnail for not to wait until all the 25-30 photos are loaded because it slows down my website. Any ideas how to do that? Answer First, put all 25-30 photos on the page
Get path and query string from URL using javascript
I have this: I want this: how do i do this in javascript? I tried window.location.href but it is giving me whole url I tried window.location.pathname.substr(1) but it is giving me found-locations/ Answer Use location.pathname and location.search:
On submit, load a html popup file into a div
I am trying to redirect to a contact form on submit to a HTML file which I have made using. However, this loads it to a different page and not to the page that I’m already on. I already have the jQuery to make a popup for the contact form and information page, which is: On submitting the contact form,