Showing posts with label jQuery. Show all posts
Showing posts with label jQuery. Show all posts

Wednesday, April 02, 2014

jQuery load causes IE 10/11 to crash

If you are getting crashing errors in IE 10 and 11 that say that the domain is not responding with a button to "recover webpage".



 Look for two things, I am certain there are more out there, so feel free to let me know if you find any others.

 1. jQuery calls to the load function $('someimage').load( NEW_IMAGE_URL,function(){ });

 If you find these just replace them with a simple attr update like so
 $('someimage').attr('src', NEW_IMAGE_URL);

 2. IE has trouble with the console so make sure to remove or test the browser before using console.log();


Stumble Upon CodePyro

Thursday, October 17, 2013

jQuery UI accordion Scroll to top

When your jquery accordion has alot of content it tends to scroll the user toward the bottom of the page. If you want to scroll back to the top of the section they opened change your js to look like-a-so.

$(".accordion").accordion({
        activate: function(event, ui){
             var scrollTop = $(".accordion").scrollTop();
             var top = $(ui.newHeader).offset().top;
          //do magic to scroll the user to the correct location
          //works in IE, firefox chrome and safari
             $("html,body").animate({ scrollTop: scrollTop + top -35 }, "fast");
            },
         heightStyle: 'content' ,
        active: false,
         
    });


Stumble Upon CodePyro

Thursday, September 16, 2010

jquery "Failed to load source for:" ajax, post error

All afternoon I have been setting up the very awesome jquery Star Widget from http://orkans-tmp.22web.net/star_rating/index.html.

Just restart firefox.. erf... or read the procedure of suffering below.


I have been setting it up in a testimonials/ratings system for an older website. The jquery post calls a cfc which was returning values while fixing minor issues with the code. Then all of a sudden it started to throw the error in firebug "Failed to load source for: http://domain.com/ratings.cfc". This was strange because I could call the CFC directly.

So, after restarting Coldfusion and reloading the fusebox app probably a million times with no results. I thought hrm, just for kicks ill restart firefox v3.6.8 and BAM! it started working again.

Time to go look for the newest version of firefox, dang what a waste of time.


Stumble Upon CodePyro

Sunday, January 03, 2010

Open a Thickbox window from inside a thickbox window

Do you need to open a thickbox window in the originating page from inside a thickbox window/iframe? (I know its confusing right? definitely pandoras box of thickboxes )

download the modified thickbox code
(Note I have not made a sample but can upon request)

Setup a normal thickbox link/page. For instance this link opens the first thickbox window in an iframe 650 wide by 400 tall.

//header information for test page
<link href="assets/css/thickbox.css" rel="stylesheet" type="text/css" />
<script src="assets/javascript/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script> 
<script src="assets/javascript/thickbox.js" type="text/javascript" charset="utf-8"></script> 

<a href="FirstWindow.htm?=true&TB_iframe=true&height=400&width=650" class="thickbox" title="First Window">Open First Window</a>

Then setup the page that opens in the iframe window with the thickbox_iframe. It has been modified to open a new thickbox window in the iframes "Parent window".
By using this method the new window will replace the original window the user originally clicked on.
//header information for Second Window
<link href="assets/css/thickbox.css" rel="stylesheet" type="text/css" />
<script src="assets/javascript/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script> 
<script src="assets/javascript/thickbox_iframe.js" type="text/javascript" charset="utf-8"></script> 

<a href="SecondWindow.htm?=true&TB_iframe=true&height=400&width=650" class="thickbox" title="second window">Open second Window</a>
 
DEMO
http://labs.codepyro.com/samples/
http://labs.codepyro.com/samples/thickbox_iframe_parentwindow_working.zip


Stumble Upon CodePyro

Wednesday, November 25, 2009

Having a frustrating day tring to get IE7 or IE8 to load javascript

Today, I experienced a 10hr hate-fest with Internet Explorer. Normally the foaming at the mouth and snarling ends after a couple of hours of fighting CSS. Well not this time. Today's issue revolved around IE and javascript.

For those techies out there I would like to explain that I keep Win Auto Updates turned off. This is because I very rarely approve of anything Microsoft "Fixes" on its first try.

THE ISSUE:
Yesterday I needed to debug some CSS & jQuery issues with IE, no big deal just some margin adjustments. Inexplicably neither IE7 (standalone) nor IE8 would run jQuery, eventually I figured out that it was not only jQuery but JavaScript itself. To discover this I used the development tools in IE which stated that "a break-point cannot be added, because the document has not loaded" (or some such nonsense). Which confirmed my theory that JS was not loading at all.

To try and fix the issue, I tried checking the security settings to Enable JavaScript, setup the site as a trusted site and re-installed the program a few times. Nothing worked and javascript continued not to run. I even tried running the browsers from Spoon.net.

After much "googling" forums, jQuery, IE, etc a friend of myne over at xaossoft.com discovered the following fix. Which fixed the issue INSTANTLY!!


Start > Run...
In the Run box, type in (without quotes) "regsvr32 jscript.dll"
You should receive a popup says that it registration succeeded.


Original solution


Stumble Upon CodePyro

Thursday, November 12, 2009

Simple jQuery UI Reservations select


If you need a quick jQuery & jQuery UI datePicker script that will restrict the range of the selects, then you've come to the right psot.

Today's script is a widget that has 2 datePicker choices "check in" and "check out".
The date selector for the #checkout needs to be setup so a #checkout date cannot start before the #checkin date and viceversa.

Here is the snippet to setup the jQuery UI datepicker object for both the #checkin and #checkout.
Note that in order for the date picker to open on both the image and input box you need the attribute "showOn" set to "both", other options and documentation can be found at the jQuery UI site.

The attribute "beforeShow" is an event handler that will call the customDateFunction before the datepicker is shown to the user.


$(document).ready(function(){
$("#checkin,#checkout").datepicker({
showOn: "both",
buttonImage: 'assets/javascript/jquery/calendar.png',
buttonImageOnly: true,
beforeShow: customDateFunction,
dateFormat: "mm/dd/yy",
firstDay: 1,
changeFirstDay: false
});
});



The "beforeShow" event passes a reference to the object that its being called on i.e. the input box in this case. We will use this to check which input box it is.

To make sure the #checkout date cannot start before the #checkin date we need to make sure the #checkout is not empty then set & return the attribute maxDate to the jQuery UI datePicker. The maxDate will disable any future dates so the user will only be able to select a start date up to the maxDate.



/*
use the dateMin and dateMax attributes to enable
the date selection to not end before the start date and
not start before the end date
*/
function customDateFunction(input)
{
//if the button called is checkin
//set the maxDate to the checkout date
if (input.id == "checkin")
{
if ($("#checkout").datepicker("getDate") != null)
dateMax = $("#checkout").datepicker("getDate");

return {maxDate: dateMax};
}
else if (input.id == "checkout")
{
if ($("#checkin").datepicker("getDate") != null)
dateMin = $("#checkin").datepicker("getDate");

return { minDate: dateMin };

}


}


Stumble Upon CodePyro