w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
  Home » JAVASCRIPT » Page 5
timed rectangle animation javascript
Have you though about css animation? It can come really handy, and has a better performance than javascript. You can use transitions on position, and even delay if you don't care about IE9 and before. If you do, you should initiate the animations with javascript by adding a class to each boxes, and that would make it cross-browser. Bassic css mockup for this would look something like this: .b

Categories : Javascript

ng-repeat not working in angular
The {{ curlies are being parsed by laravel, you have to change interpolation in angular. myApp2.config(function($interpolateProvider){ $interpolateProvider.startSymbol('{[{').endSymbol('}]}'); }); and then use {[{ and }]} for the angular part of variables.

Categories : Javascript

array reference javascript angular
OK, so more code does help. It looks like you have asynchronous logic happening here. loadTiming is fired, which does a POST and then a splice on the Times array. One console.log could be firing before this POST and the other after. There's no easy way to tell. One possible fix would be to only log these once the loadTiming async process runs. Return a promise from the loadTiming function an

Categories : Javascript

Passing a PHP variable into flot Bar chart
If $studentages is an array of integers, this means that var data = [ 0, [1, 2, 3, 4, 5]]; This is not the correct format for flot data which expects an array of arrays. So, try: var data = $.map(<?php echo '['.implode(", ", $studentages).']'?>, function(val, idx){ return [[idx, val]]; }); var dataset = [ { label: "Exams By Student Age", data: data, color: "#5482FF" } ]; va

Categories : Javascript

Add filesize or hash after URL to get correct caching
I dont know where you got access to but i assume you can use php. So you should append an md5 (generated by md5_file()) as parameter to your string. The parameter will only change, if you upload a new pdf (mtime() will have the same effect)

Categories : Javascript

Fire 2 actions with ONE click on a button
if you want to assign 2 different actions on one button, set it 2 different classes (or IDs), lets say <div class="action1 action2"> After, in jQuery you will be able to do: $('.action1').on('click', function (e) { console.log('#1'); ... }); $('.action2').on('click', function (e) { console.log('#2'); ... }); JsFiddle: http://jsfiddle.net/g2wdd2cb/

Categories : Javascript

Website not rendering after ember js implementation
Youre missing a few ideas of ember - Naming is important. You have posts - which should be in a model and then use the fixture adapter to declare them. You have a posts template but no posts route defined or in your router. this.resource("posts", {path: "/posts"}, function(){ this.resource("post", {path: "/:post_id"}); }); You have no index route in your router. this.resource("index", {p

Categories : Javascript

Angular services and browserify
One disadvantage to doing this is writing unit tests. It will be difficult to mock your dependencies if you are simply requiring them rather than using Angular's dependency injection. This is somewhat of a dealbreaker for me because one of the many benefits of using Angular is the testability of the framework.

Categories : Javascript

Highcharts JS - heatmap set gridLineWidth
I would suggest to go with the axis min : 0, max : 1, gridZIndex : 10, gridLineWidth : 1, Take a look at this, maybe you find out, how to make it work as you want it. http://jsfiddle.net/u765vneL/

Categories : Javascript

snap.svg drag "real" position
You can do this by grabbing the bounding box of the element being moved, and then change the attribute to that. So the additional code would be... var bb = this.getBBox(); line.attr({ x2: bb.cx, y2: bb.cy }) jsbin You can also get rid of the matrix stuff... jsbin

Categories : Javascript

enableling spyjs code completion in phpstorm
Spy-js 2.0 features (including autocompletion) are available in PhpStorm >=8.0.2. At the moment it's not released, but EAP build is already available, just install it and spy-js plugin will suggest you to update it.

Categories : Javascript

Changing JavaScript into jQuery - createElement
Change your dom object to a jQuery object by calling $(newdiv) and re-initialise the resizable and draggable functionality on the new content. function addnewbox() { var newDiv = document.createElement("div"); var h = document.createElement("h3"); var text = document.createTextNode("MS"); newDiv.appendChild(h); newDiv.className = "ui-widget-content"; h.appendChild(tex

Categories : Javascript

could not show tooltip on mouse over , jquery1.11
You have it working, you just need to apply a title="" attribute to the items you want to have a tooltip. <td class="sample-two">Row1 <img class="one" src="http://ssl.gstatic.com/gb/images/b_5dae6e31.png" width="15" height="15" alt="" title="testing"/> Working JSFiddle: http://jsfiddle.net/ubKtd/1132/ row1's img says testing. Also I suggest visiting: http://jqueryui.com/tooltip/

Categories : Javascript

Conditionally serving different javascript for different screen sizes
you can use wurlf to check in what platform you are. and use require.js to load the module.

Categories : Javascript

How to validate a strict URL
Some validations were removed in Parsley 2.x and Url strict was one of them. However, you can still download version 1.2.3, navigate through the source code and check what was the regular expression used to validate a strict url. With that regular expression, you can create a custom validator in v2.x. Having done that, you should end up with the following code: <input type="text" name="url"

Categories : Javascript

How can I use Tracker.autorun in a static non-Meteor page?
I have isolated Tracker and all of its dependencies down to a single library you can refer to here: https://s3.amazonaws.com/www.chicagogrooves.com/js/meteor-reactive-packages.js This gives you Tracker, ReactiveDict, ReactiveVar, and their dependencies EJSON and Base64 in a single library (41Kb raw unminified, 11Kb gzipped). The only dependency I did not include is UnderscoreJS, as you may want t

Categories : Javascript

create dynamic image with php
With wkhtmltoimage you can convert HTML to an images. You would need a VPS to run it on though. You can then create the HTML and call wkhtml2image via PHP to convert the given HTML to an image.

Categories : Javascript

Change data in PDF from HTML/JS
I think what you want to do is creating a new pdf, inserting the template and name and stuff. But I do not think it is possible with Javascript alone, but with an ajax call to your server. PHP for example got TCPDF library which is relatively easy to use.

Categories : Javascript

Why not run?(Capitalize the first letter of every word)
Try this, if id resualt is correct. I have set fiddler to test. document.getElementById("resualt").innerHTML = str.replace(/wS*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();}); Demo

Categories : Javascript

Why keep project dependencies current?
The fact that your code is (still) running and working as expected doesn't mean that security flaws discovered after your deployment don't affect your system. You could ask the same thing about any update to your operating system - "It still works, so why should I install the latest updates?". You need to update your software in order to stay in the loop with regard to bug fixes/security issues

Categories : Javascript

Dialog is not opening after some time
Without having more information, I would try to just "open" the dialog with your deleteNode function rather than re-initializing it every time. $("#deleteNodeDialog").dialog({ /*My delete node functionality here*/ }); Then function deleteNode(d) { $("#deleteNodeDialog").dialog("open"); } This way you aren't recreating it when it isn't necessary.. UNLESS there is more going o

Categories : Javascript

IE prompting to close a popup that I created
I'm not sure how it is working in other systems, however this should be a correct way. You have to pass a reference object of opened window to close function. $("#submit").click( function () { //...some sync ajax calls popUp.close(); }); See this: MDN

Categories : Javascript

Unable to post JavaScript object to asp.net web api end point
You shouldn't try to pass multiple parameters. Change the signature to this: public dynamic Save([FromBody] List<MyObject> data) Also, try to stringify your object before passing it to the Web API: JSON.stringify(data);

Categories : Javascript

IndexedDB - Dexie JS : Dynamically create stores
Let's say you want three object stores "Doctors", "Patients" and "Hospitals", you would write something like: var db = new Dexie ("your-database-name"); db.version(1).stores({ Doctors: "++id,name", Patients: "ssn", Hospitals: "++id,city" }); db.open(); Note that you only have to specify the primary key and the required indexes. Primary key can optionally be auto-incremented ("++" pr

Categories : Javascript

How does this old jQuery function cause some error messages to be suppressed?
The old jQuery 1.4.4 used to wrap the code that did the mouseenter/mouseleave events in a try{}catch(e){} that throws away the error: See https://github.com/jquery/codeorigin.jquery.com/blob/master/cdn/jquery-1.4.4.js#L2487 You'll see that behavior until the effects rewrite that went in for jQuery 1.7.

Categories : Javascript

Add Facebook comments to my iOS app
It worked for me perfectly. NSString *html =@" <!DOCTYPE html> <html> <head> </head> <body> <div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=211241782359485"; fjs.par

Categories : Javascript

How to change calender date to date using moment.js?
No it's impossible to go from a calendar string (like Today at 8:45 AM) to a moment. Or, technically, you could build the pieces of the moment yourself but it'd likely not be worth it. If you really need to do it this way take a look at: http://momentjs.com/docs/#/i18n/changing-locale/ That gives you a look at how the calendar strings work internally. But there aren't any moment methods that do i

Categories : Javascript

AngularJS: Error: [$parse:syntax] Syntax Error for @ and
You need to escape the strings in the generated expression. So (just the 2nd line): + "<a ng-click='reInvite(" + rowID + ","" + tname + "","" + email + "")'>ReInvite</a>" // ^ ^ ^ ^ // | | | | // look here --------------------------+-------------+--+----------

Categories : Javascript

How to prevent "Not responding" error?
This most likely happens because you give your function a 1 second interval between the script loadings, but it takes internet explorer more than 1 second to load the script and so it starts loading it again before it finished the first one, and that causes a high resource usage because it makes the loadings accumulate one on top of another before they even finish. im not sure how your tracking w

Categories : Javascript

Javascript matrix multiplication by scalar
I commented out //this.vertices = vertices; because im not sure if I have to set vertices here You either need to set it there or at the end of the constructor. Your setScale function is nicely decoupled from where the vertices array is stored and I'd keep it that way. But you might consider renaming it scaleVertices() instead. When I do it like this though the for loop will reiterate. I

Categories : Javascript

Retrieve the ListItem index in Google Doc
There is currently no way to find out this information. Please file an enhancement request for this feature at the Apps Script issue tracker.

Categories : Javascript

Overflow hidden questionmark split words to two line
You need to add white-space: nowrap; and change the width to display however much you would like. Check this out to read more about it. #t { overflow:hidden; width:50px; text-overflow:ellipsis; display:block; white-space: nowrap; } Demo Here

Categories : Javascript

TimeOut doesn't work, even with sinon.useFakeTimer()
I found the way to make a setTimeOut works in Mocha for node.js. // We need to pass the mocha's function 'done' that tells mocha to wait till this function is called it('It should wait around 5 seconds', function(done){ // We augment mocha's timeout to more than default 2000ms // we put more than the 5 seconds of setTimeout to asure us this.timeout(6 * 1000); setTimeout(functio

Categories : Javascript

injecting html to another element by html() or append() using jq the injected elements cant be accessed by jq but with JS it works?
//This works $("#addNew").click(function(){ //This does work, but... $('<img class="MyClassName" src="0369.png">') .appendTo($("#Q_countainer")) .click(function(){ alert("HERE 1"); }); }); // ... this is better (this will work only *after* #addNew will have been clicked) // This is called delegated events and is a good practice. $(document).on("click",".MyCla

Categories : Javascript

jQuery chosen not working for cloned row
You should clone first and apply chosen later so the cloned element is "chosen free". jQuery(function($){ var clone = $("table tr.data-wrapper:first").clone(true); $('select.name').chosen({width: "100%"}); $('body').on('click', '.add-new-data', function() { var ParentRow = $("table tr.data-wrapper").last(); clone.clone(true).insertAfter(ParentRow); $('tr.data-

Categories : Javascript

How to call a function in Javascript when a input changes value?
$("#username").on( "change", handler ) or in short form $("#username").change( handler ) And get rid of the inline onchange attribute. You will also need to wrap the code in a ready function: $(document).ready(function(){ $("#username").change( handler ) }); http://api.jquery.com/change/ Added after reading the question a bit more carefully: If you want to link your input name="thingy

Categories : Javascript

How to transfer Leaflet Markers Lat/Long in textbox
markerA.getLatLng() returns a Leaflet LatLng object. To get the numbers individually, do something like: var ll = markerA.getLatLng(); alert("latitude: " + ll.lat); alert("longitude: " + ll.lng); Then assign it to the input boxes as you would with any other Javascript task: var ll = markerA.getLatLng(); document.querySelector('#userLat').value = ll.lat; document.querySelector('#userLng').value

Categories : Javascript

How to select the td where my active element is in
$(document).on('change','#foo',function(){ $(this).parent('td').html($(this).val()); $(this).remove(); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <table> <tr> <td> <select id="foo"> <option value="">--Select--</option> <option value="Value 1">Value 1</

Categories : Javascript

How to use CSS files and Javascript libraries in JIRA gadgets
In your gadget.xml file you have to include the resources via the project key and the gadget key and you defined. - the gadget key in your case is "Web-resources" (I recommend you rename it to mygadget-resources) - the project key is defined in your atlassian-plugin.xml file as attribute of element <atlassian-plugin key="your-project-key"> In your gadget.xml file in the CDATA section insid

Categories : Javascript




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.