Search Results

Search found 21131 results on 846 pages for 'jquery dialog'.

Page 7/846 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • JQuery UI question, how do you add variables into the dialog box

    $('.openDialog').click(function(event){ var width=$(this).attr('width'); var height=$(this).attr('height'); alert(width + ' ' + height); event.preventDefault(); $("#dialog").dialog({autoOpen: false, modal: true}); $('#dialog').dialog('option', 'width', width); $('#dialog').dialog('open'); $('#dialog p').load('http://pagetoload.com/page.html .content'); }); As you can see above i'm trying to open a dialog box with a passed in parameter of width and height, however when I try and pass in the value of width on this line: $('#dialog').dialog('option', 'width', width); it doesn't work, any ideas why or how to get around that? Thanks

    Read the article

  • JQuery dialog momentairly displayed on page load

    - by Kevin Won
    I created a page that has a JQuery based dialog using the standard JQuery UI function. I do this with out of the box functionality of JQuery... nothing special at all. Here is my HTML for the dialog: <div id = "myDialog"> <!-- ... more html in here for the dialog --> </div> Then the JQuery called in javascript that transforms the <div> to a dialog: // pruned .js as an example of kicking up a JQuery dialog $('#myDialog').dialog({ autoOpen: false, title: 'Title here', modal: true } }); Again, plain-vanilla JQuery. So you start this wizard by clicking on a link on the parent page, and it then spawns a JQuery dialog which has a significant chunk of HTML that includes images, etc. As I continued developing this page, I started to notice that when I loaded the page in the browser that the <div> tags I was putting in that JQuery transforms into dialogs would very briefly be displayed. Then the page would act as expected. In other words, the dialog would not be hidden, it would be displayed briefly in-line in the page. Quite ugly and unprofessional looking! But after a split second, the page would render correctly and look just as I expected/wanted. Over time, as the page size grew, the time the page would remain incorrectly rendered grew. My guess is that the rendering engine of the browser is rendering the page as it is loading, then at the end it is kicking off the JQuery that will transform the <div> into a dialog. This JQuery function will then transform the simple <div> to a JQuery dialog and hide it (since I have the autoOpen property set to false). Some browsers <cough>IE</cough> display it longer than others. My large-ish dialog now causes the page to incorrectly render for about 1 second... YUCK! I came up with a resolution to this problem which works OK, but I'm wondering if someone knows of a better way.

    Read the article

  • Using jQuery Live instead of jQuery Hover function

    - by hajan
    Let’s say we have a case where we need to create mouseover / mouseout functionality for a list which will be dynamically filled with data on client-side. We can use jQuery hover function, which handles the mouseover and mouseout events with two functions. See the following example: <!DOCTYPE html> <html lang="en"> <head id="Head1" runat="server">     <title>jQuery Mouseover / Mouseout Demo</title>     <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.4.4.js"></script>     <style type="text/css">         .hover { color:Red; cursor:pointer;}     </style>     <script type="text/javascript">         $(function () {             $("li").hover(               function () {                   $(this).addClass("hover");               },               function () {                   $(this).removeClass("hover");               });         });     </script> </head> <body>     <form id="form2" runat="server">     <ul>         <li>Data 1</li>         <li>Data 2</li>         <li>Data 3</li>         <li>Data 4</li>         <li>Data 5</li>         <li>Data 6</li>     </ul>     </form> </body> </html> Now, if you have situation where you want to add new data dynamically... Lets say you have a button to add new item in the list. Add the following code right bellow the </ul> tag <input type="text" id="txtItem" /> <input type="button" id="addNewItem" value="Add New Item" /> And add the following button click functionality: //button add new item functionality $("#addNewItem").click(function (event) {     event.preventDefault();     $("<li>" + $("#txtItem").val() + "</li>").appendTo("ul"); }); The mouse over effect won't work for the newly added items. Therefore, we need to use live or delegate function. These both do the same job. The main difference is that for some cases delegate is considered a bit faster, and can be used in chaining. In our case, we can use both. I will use live function. $("li").live("mouseover mouseout",   function (event) {       if (event.type == "mouseover") $(this).addClass("hover");       else $(this).removeClass("hover");   }); The complete code is: <!DOCTYPE html> <html lang="en"> <head id="Head1" runat="server">     <title>jQuery Mouseover / Mouseout Demo</title>     <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.4.4.js"></script>     <style type="text/css">         .hover { color:Red; cursor:pointer;}     </style>     <script type="text/javascript">         $(function () {             $("li").live("mouseover mouseout",               function (event) {                   if (event.type == "mouseover") $(this).addClass("hover");                   else $(this).removeClass("hover");               });             //button add new item functionality             $("#addNewItem").click(function (event) {                 event.preventDefault();                 $("<li>" + $("#txtItem").val() + "</li>").appendTo("ul");             });         });     </script> </head> <body>     <form id="form2" runat="server">     <ul>         <li>Data 1</li>         <li>Data 2</li>         <li>Data 3</li>         <li>Data 4</li>         <li>Data 5</li>         <li>Data 6</li>     </ul>          <input type="text" id="txtItem" />     <input type="button" id="addNewItem" value="Add New Item" />     </form> </body> </html> So, basically when replacing hover with live, you see we use the mouseover and mouseout names for both events. Check the working demo which is available HERE. Hope this was useful blog for you. Hope it’s helpful. HajanReference blog: http://codeasp.net/blogs/hajan/microsoft-net/1260/using-jquery-live-instead-of-jquery-hover-function

    Read the article

  • useFastClick in JQuery Mobile

    - by Yousef_Jadallah
      Normal 0 false false false EN-US X-NONE AR-SA /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin-top:0cm; mso-para-margin-right:0cm; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0cm; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:Arial; mso-bidi-theme-font:minor-bidi;} For who want to convert the application from JQM Alpha to JQM Beta 1, needs to bind  click  events to the new vclick one. Click event is working in general browsers butt that is needed for iOS and Android, useFastClick  is (touch + mouse click). Moreover if you have this event alot in your project you can turn useFastClick off in mobileinit event: $(document).bind("mobileinit", function () {             $.mobile.useFastClick = false; });   vclick event is needed to support touch events to make the page changes to happen faster, and to perform the URL hiding. So you need to change something like this  $('btnShow').live("click", function (evt) {   To :  $('btnShow').live("vclick", function (evt) {     For more information : http://jquerymobile.com/test/docs/api/globalconfig.html   Here you can find full example in this case : <!DOCTYPE ><html xmlns="http://www.w3.org/1999/xhtml"><head>    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.css" />    <script src="http://code.jquery.com/jquery-1.6.1.min.js"></script>    <script src="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.js"></script>    <script type="text/javascript">     //Here you need to use vclick instead of click event         $('ul[id="MylistView"] a').live("vclick", function (evt) {            alert('list click');        });      </script>    <title></title></head><body>    <div id="FirstPage" data-role="page" data-theme="b">        <div data-role="header">            <h1>                Page Title</h1>        </div>        <div data-role="content">            <ul id="MylistView" data-role="listview" data-theme="g">                <li><a href="#SecondPage">Acura</a></li>                <li><a href="#SecondPage">Audi</a></li>                <li><a href="#SecondPage">BMW</a></li>            </ul>        </div>        <div data-role="footer">            <h4>                Page Footer</h4>        </div>    </div>    <div id="SecondPage" data-role="page" data-theme="b"   >        <div data-role="header" >            <h1>                Page Title</h1>        </div>        Second Page        <div data-role="footer">            <h4>                Page Footer</h4>        </div>    </div></body></html>     Hope that helps.

    Read the article

  • jquery ui dialog and our dearest friend, ie6

    - by bradjive
    I'm using the jquery ui dialog for a modal popup dialog. It's working great in Firefox/Chrome but terrible in ie6. Problem: When I show the dialog in ie6, the browser window grows and automatically scrolls down to the bottom. The height increase and automatic scroll-down is equal to the height of the jquery dialog. I can scroll up and then use the dialog as normal, but the behavior where it grows the window and drops is maddeningly unacceptable. Here is how I'm launching the window: <div id="dialogWindow"></div> ... $(document).ready(function() { var $dialog = $("#dialogWindow").dialog({ autoOpen: false, modal: true, minWidth: 560, width: 560, resizable: "true", position: "top" }); $('.addButton').click(function(e) { e.preventDefault(); $('#dialogWindow').load('http://myurl'); $dialog.dialog('open'); }); }); I am already using the bgiframe plugin for jquery which is key for ie6 overlay issues. But this seems unrelated to that. Has anyone seen this before and found a work around?

    Read the article

  • Rebind dymanically created forms after jQuery ajax response

    - by Pjack
    I'm kinda new to jQuery but understand it for the most part. My problem is that when my ajax call which refreshes the entire div is done, all my dynamically created forms don't work. If you try and submit them, the event doens't work properly and just tries to do a normal form submit. I have all the other items such as links bound using the .live() which seem to work great. Just the form dies. How do I rebind the dynamically created forms after the ajax call? They all have id of formname_id. I tried to use bind but it doesn't work as below. Any help is appreciated. Here is the code jQuery(document).ready(function(){ jQuery("form[id^='commentform_']").each(function(){ var id = parseInt(this.id.replace("commentform_", "")); jQuery(this).bind('submit', function(e) { var action = jQuery('#action_' + id).attr('value'); var act_id = ('1'); jQuery.ajax({ type: "POST", url: "ajax/modify.php", data: "action="+ action +"& act_id="+ act_id, success: function(response){ jQuery('#CommentsContainer_' + id).html(response); jQuery('#commentform_' + id)[0].reset(); } }); return false; }); }); });

    Read the article

  • jqueryUI dialog box header size

    - by Ayaz Alavi
    Hi, I am creating hotel booking system which requires lots of modal dialogs. For this purpose I am using jqueryUI dialog widget. yesterday I embedded it on one of the features of application but this time when dialog opens upon click then its Header is very large about 300-400px in height where as normal header is about 40px in height. Everywhere in the application it is still working fine but at only place it is giving such error. Css is also identical at all places. If anybody knows how to fix this issue then please post here. Thanks Ayaz Alavi

    Read the article

  • Window scrolling up when jquery dialog opens up

    - by zoom_pat277
    I am trying to open a modal jquery dialog using jquery 1.4 and jquery-ui-1.8rc3.custom.js The dialog opens up with no issues, in all browsers, but in IE 7 and 6, after the dialog opens up, the window scrolls itself to the buttom... I tried scrolling the window up back to the modal position but is very inconsistent. was using the following line of code after opening up the modal window.scrollTo($('selector').dialog('option', 'position')[0],$('selector').dialog('option', 'position')[1]); One weird thing I am noticing is that after I open the modal, the page becomes huge... as if some extra things adds up on the bottom .... and it eventually scrolls to the bottom. Any idea why this could be hapenning in html <div id="selector"> </div> in document.ready $('#selector').dialog({ bgiframe: true, autoOpen: false, width: 100, height: 100, modal: true, position: 'top' }); in js $('#selector').dialog('open');

    Read the article

  • Why is this jquery dialog window not displaying?

    - by user338413
    I've got a form that is using jquery validation. When the user clicks the submit button, I've got some jquery that intercepts the submit and should display a dialog window asking the user to verify the information they entered on the form. This dialog window should only display if the form has validated. Here is my code: $('#form').submit(function(){ fillVerificationDialog(); /* This loads up the dialog with form data */ if (('#form').valid()){ $('verification_dialog').dialog('open'); return false; } }); My dialog window is not displaying. It just submits the form. And I've verified that the form is valid by using an alert that checks the value of $('#form').valid() If I remove the if statement and just have the line that opens the dialog, the dialog displays. However, it will display even if the form has errors which is what I'm trying to prevent.

    Read the article

  • How to close jQuery Dialog within the dialog?

    - by imperialx
    Hello, How to close jQuery Dialog within the dialog without using the close button? Inside the ui dialog is a simply form request and if a successful submission occurs, then the ui dialog automatically closes and refreshes the parent page. <script type="text/javascript"> $(document).ready(function () { $("#form-dialog").dialog({ autoOpen: true, modal: true, width: 200, draggable: true, resizable: true }); }); </script> <div id="form-dialog" title="Form Submit"> <form action="default.aspx" method="post"> <input type="text" name="name" value=" " /> <input type="submit" value="submit" /> </form> </div> -imperialx

    Read the article

  • All browsers crash when file uploading or downloading dialog opens up

    - by Mitulát báti
    I pretty much summarized the problem in the title. I tried to get some solutions. All I found was check if the Chrome has any concurrent or erroneous applications installed on my computer that conflicts with Chrome (by typing chrome://conflicts). But "unfortunately" it said that there are no perceived conflicts. First I thought it is only with Chrome, but soon I saw that no. All internet browsers are affected. I noticed this problem after I installed Fruity Loops, but uninstalling it didn't solve the problem. Maybe Fruity loops is not the guilty reason. Have any of you met this problem before? What should I do? Thank you. UPDATE: Sorry I forgot that this is under Windows 8.1.

    Read the article

  • CKEditor instance in a jQuery dialog

    - by Gazillion
    Hey, I am using jQuery to open a dialog window with a textarea transformed into an instance of CKEditor. I'm using the jQuery adapter provided by the CKEditor team but when the dialog window opens up I cannot interact with the editor (it's created but "null" is written in the content space and I can't click on anything or modify the content). This bug report seems to say that by using a patch provided the issue is fixed but it doesn't seem to be working for me... Here's my code (maybe I did something wrong programmatically): HTML: <div id="ad_div" title="Analyse documentaire"> <textarea id="ad_content" name="ad_content"></textarea> </div> My includes (Everything is included correctly but maybe it's an including order issue?): <script type="text/javascript" src="includes/ckeditor/ckeditor.js"></script> <link rel="stylesheet" type="text/css" href="includes/jquery/css/custom-theme/jquery-ui-1.7.2.custom.css" /> <script type="text/javascript" src="includes/jquery/js/jquery-1.3.2.min.js"></script> <script type="text/javascript" src="includes/jquery/js/jquery-ui-1.7.2.custom.min.js"></script> <script type="text/javascript" src="includes/jquery/plugins/dialog-patch.js"></script> <script type="text/javascript" src="includes/ckeditor/adapters/jquery.js"></script> Javascript: $('#ad_content').ckeditor(); /* snip */ $('#ad_div').dialog( { modal: true, resizable: false, draggable: false, position: ['center','center'], width: 600, height: 500, hide: 'slide', show: 'slide', closeOnEscape: true, autoOpen: false }); $('.analyse_cell').click(function(){ $('#ad_div').dialog('open'); });

    Read the article

  • jQuery li:has(ul) selector issue

    - by sushil bharwani
    I was creating a tree using UL LI list and jQuery. I used a jQuery Selector jQuery(li:has(ul)) to find all the list nodes having childs and then added a click event to it. jQuery(li:has(ul)).click(function(event) { jQuery(this).children.toggle(); jQuery(this).css("cursor","hand"); }); This works for me except i dont understand why i get a cursor hand and click event triggering even when i take mouse pointer to childs of my selected li <li> Parent // it works here that is fine <ul> <li> child1 // it works here i dont understand need explanation </li> <li> child2 // it works here i dont understand need explanation </li> </ul> </li>

    Read the article

  • jQuery selecrors. help for newbie

    - by Shamanu4
    Hello. I have this code, which open new jquery-ui dialog and then hide the dialog's titlebar. <div id="keyboard" class="keyboard dialogs">...</div>   $("#keyboard").dialog({ width: 1136, height: 437, position: ['center',400], closeOnEscape: false, autoOpen: false, resizable: false, open: function(event, ui) { $(".ui-dialog-titlebar").hide(); // <-- this selector i want to change } }); But $(".ui-dialog-titlebar") select all titlebars. How do i have change selector to hide only this titlebar?

    Read the article

  • Get reference to all instances of jquery ui widget?

    - by Hailwood
    I am writing a jquery UI widget that simply wraps the bootstrap popover plugin, In the widget you can pass in the option 'singular', if this is passed in then it should call a function of all other instances of the plugin. something like $('#one').myWidget(); $('#two').myWidget(); $('#three').myWidget(); $('#four').myWidget(); $('#one').myWidget('show'); //stuff from widget one is now visible $('#two').myWidget('show'); //stuff from widget one and two are now visible $('#three').myWidget('show'); //stuff from widget one, two and three are now visible $('#two').myWidget('hide'); //stuff from widget one and three are now visible $('#four').myWidget('show', {singular:true}); //stuff from widget four is now visible So, I imagine the show function looking like: show: function(options){ options = options || {}; if(options.singular){ var instances = '????'; // how do I get all instances? $.each(instances, function(i, o){ o.myWidget('hide'); }); } this.element.popover('show'); } So, question being, how would I get a reference to all elements that have the myWidget widget on them?

    Read the article

  • Jquery Modal Dialog disables form elements

    - by Mr W
    Hi, When I set my jQuery dialog to model=true, it disables my form elements inside the dialog and I cannot use them, only the buttons. I have seen examples where the contents of the dialog is declared in the dialog initiation script and then injected. but that is just to bulky for me, I want to be able to create my markup inside the DIV which I turn into a dialog. Anyone got a solution for me?

    Read the article

  • how to make jquery ui dialog not resizable

    - by Omu
    anybody knows how to make the jquery dialog not resizable ? I call it like this atm : var elem = $("#mydiv"); elem.dialog({ modal: true, title: 'title', buttons: { Ok: function() { $(this).dialog('close'); } //end function for Ok button }//end buttons }); // end dialog elem.dialog('open');

    Read the article

  • Accessing a dialog from Another dialog MFC

    - by Isuru
    Hi, I want to open a separate dialog box when I cllick on a button on my main dialog. I used separateDialog.DoModal() to do it. It open successfully but when I try to add data to a edit control (text box) in that seperate dialog, a debug assertion failure occurs. What is the matter and how can I overcome it? Thank You!!

    Read the article

  • how to autocenter jquery ui dialog whenb resizing browser?

    - by Jorre
    When you use jquery UI dialog, all works well, except for one thing. When the browser is resized, the dialog just stays in it's initial position which can be really annoying. You can test it out on: http://jqueryui.com/demos/dialog/ Click on the "modal dialog" example and resize your browser. I'd love to be able to let dialogs autocenter when the browser resizes. Can this be done in an efficient way for all my dialogs in my app? Thanks a lot!

    Read the article

  • White dialog theme

    - by Al
    I've noticed some apps have a dialog with white background, including along the title border, as opposed to the default black. I know how to make the background white but the whiteness doesn't extend to the dialog's title border. This image: http://localhostr.com/files/25bb19/tether.png is an example of how I want the dialog to look. Anyone know I can do this? I mainly use AlertDialog.Builder to make my dialogs so ideally something I can easily to that.

    Read the article

  • jquery ui dialog button

    - by mike
    Hello, With a jQuery UI dialog, I need to be able to set tooltips on buttons... I have the following code: buttons: { 'My Button' : function(e) { $(e.target).mouseover(function() { alert('test'); }); } This allows me to do something on "mouseover" but only once the button has been clicked. What do I need to do in order to make this function before the button has been clicked? Thanks

    Read the article

  • DevConnections jQuery Session Slides and Samples posted

    - by Rick Strahl
    I’ve posted all of my slides and samples from the DevConnections VS 2010 Launch event last week in Vegas. All three sessions are contained in a single zip file which contains all slide decks and samples in one place: www.west-wind.com/files/conferences/jquery.zip There were 3 separate sessions: Using jQuery with ASP.NET Starting with an overview of jQuery client features via many short and fun examples, you'll find out about core features like the power of selectors to select document elements, manipulate these elements with jQuery's wrapped set methods in a browser independent way, how to hook up and handle events easily and generally apply concepts of unobtrusive JavaScript principles to client scripting. The session also covers AJAX interaction between jQuery and the .NET server side code using several different approaches including sending HTML and JSON data and how to avoid user interface duplication by using client side templating. This session relies heavily on live examples and walk-throughs. jQuery Extensibility and Integration with ASP.NET Server Controls One of the great strengths of the jQuery Javascript framework is its simple, yet powerful extensibility model that has resulted in an explosion of plug-ins available for jQuery. You need it - chances are there's a plug-in for it! In this session we'll look at a few plug-ins to demonstrate the power of the jQuery plug-in model before diving in and creating our own custom jQuery plug-ins. We'll look at how to create a plug-in from scratch as well as discussing when it makes sense to do so. Once you have a plug-in it can also be useful to integrate it more seamlessly with ASP.NET by creating server controls that coordinate both server side and jQuery client side behavior. I'll demonstrate a host of custom components that utilize a combination of client side jQuery functionality and server side ASP.NET server controls that provide smooth integration in the user interface development process. This topic focuses on component development both for pure client side plug-ins and mixed mode controls. jQuery Tips and Tricks This session was kind of a last minute substitution for an ASP.NET AJAX talk. Nothing too radical here :-), but I focused on things that have been most productive for myself. Look at the slide deck for individual points and some of the specific samples.   It was interesting to see that unlike in previous conferences this time around all the session were fairly packed – interest in jQuery is definitely getting more pronounced especially with microsoft’s recent announcement of focusing on jQuery integration rather than continuing on the path of ASP.NET AJAX – which is a welcome change. Most of the samples also use the West Wind Web & Ajax Toolkit and the support tools contained within it – a snapshot version of the toolkit is included in the samples download. Specicifically a number of the samples use functionality in the ww.jquery.js support file which contains a fairly large set of plug-ins and helper functionality – most of these pieces while contained in the single file are self-contained and can be lifted out of this file (several people asked). Hopefully you'll find something useful in these slides and samples.© Rick Strahl, West Wind Technologies, 2005-2010Posted in ASP.NET  jQuery  

    Read the article

  • jquery dialog is clearing my form fields and I need to return a value from a jquery dialog

    - by Seth
    1.) I have a jQuery dialog that is opened whenever a particular textbox is focused. The dialog's contents are loaded from ajax and the unique ID of the textbox that was focused is passed in the ajax call (like this): $('[name=start_airport[]],[name=finish_airport[]]').click(function(){   var id = $(this).attr('id');   if($('#use_advanced_airport_selector').attr('checked')) {     $('#advanced_airport_selector').dialog({       open : function() {         $(this).load('/flight-booker/advanced-airport-selector.php?callerID='+id);       }     });     $('#advanced_airport_selector').dialog('open');   } }); (where advanced_airport_selector is an empty div) THAT PART WORKS FINE. However, when I make my ajax call within my dialog, all my form values are reset! No matter what I do, when that dialog opens, all form values are reset (not just the value of the textbox that was focused). I simply don't understand what would cause this behavior! But that's only issue #1. 2.) I need to be able to return a value from that dialog box. I am passing the ID in the ajax query so that I can use a jquery selector to update the caller's value after certain actions are performed within the dialog box. However, I can't actually access that textbox because of DOM_ERRORS that I've never come across. It doesn't make any sense! There's way to much code to post, and it's really hard to explain, so sorry if I'm unclear as to what I'm asking.

    Read the article

  • jQuery and Windows Azure

    - by Stephen Walther
    The goal of this blog entry is to describe how you can host a simple Ajax application created with jQuery in the Windows Azure cloud. In this blog entry, I make no assumptions. I assume that you have never used Windows Azure and I am going to walk through the steps required to host the application in the cloud in agonizing detail. Our application will consist of a single HTML page and a single service. The HTML page will contain jQuery code that invokes the service to retrieve and display set of records. There are five steps that you must complete to host the jQuery application: Sign up for Windows Azure Create a Hosted Service Install the Windows Azure Tools for Visual Studio Create a Windows Azure Cloud Service Deploy the Cloud Service Sign Up for Windows Azure Go to http://www.microsoft.com/windowsazure/ and click the Sign up Now button. Select one of the offers. I selected the Introductory Special offer because it is free and I just wanted to experiment with Windows Azure for the purposes of this blog entry.     To sign up, you will need a Windows Live ID and you will need to enter a credit card number. After you finish the sign up process, you will receive an email that explains how to activate your account. Accessing the Developer Portal After you create your account and your account is activated, you can access the Windows Azure developer portal by visiting the following URL: http://windows.azure.com/ When you first visit the developer portal, you will see the one project that you created when you set up your Windows Azure account (In a fit of creativity, I named my project StephenWalther).     Creating a New Windows Azure Hosted Service Before you can host an application in the cloud, you must first add a hosted service to your project. Click your project on the summary page and click the New Service link. You are presented with the option of creating either a new Storage Account or a new Hosted Services.     Because we have code that we want to run in the cloud – the WCF Service -- we want to select the Hosted Services option. After you select this option, you must provide a name and description for your service. This information is used on the developer portal so you can distinguish your services.     When you create a new hosted service, you must enter a unique name for your service (I selected jQueryApp) and you must select a region for this service (I selected Anywhere US). Click the Create button to create the new hosted service.   Install the Windows Azure Tools for Visual Studio We’ll use Visual Studio to create our jQuery project. Before you can use Visual Studio with Windows Azure, you must first install the Windows Azure Tools for Visual Studio. Go to http://www.microsoft.com/windowsazure/ and click the Get Tools and SDK button. The Windows Azure Tools for Visual Studio works with both Visual Studio 2008 and Visual Studio 2010.   Installation of the Windows Azure Tools for Visual Studio is painless. You just need to check some agreement checkboxes and click the Next button a few times and installation will begin:   Creating a Windows Azure Application After you install the Windows Azure Tools for Visual Studio, you can choose to create a Windows Azure Cloud Service by selecting the menu option File, New Project and selecting the Windows Azure Cloud Service project template. I named my new Cloud Service with the name jQueryApp.     Next, you need to select the type of Cloud Service project that you want to create from the New Cloud Service Project dialog.   I selected the C# ASP.NET Web Role option. Alternatively, I could have picked the ASP.NET MVC 2 Web Role option if I wanted to use jQuery with ASP.NET MVC or even the CGI Web Role option if I wanted to use jQuery with PHP. After you complete these steps, you end up with two projects in your Visual Studio solution. The project named WebRole1 represents your ASP.NET application and we will use this project to create our jQuery application. Creating the jQuery Application in the Cloud We are now ready to create the jQuery application. We’ll create a super simple application that displays a list of records retrieved from a WCF service (hosted in the cloud). Create a new page in the WebRole1 project named Default.htm and add the following code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Products</title> <style type="text/css"> #productContainer div { border:solid 1px black; padding:5px; margin:5px; } </style> </head> <body> <h1>Product Catalog</h1> <div id="productContainer"></div> <script id="productTemplate" type="text/html"> <div> Name: {{= name }} <br /> Price: {{= price }} </div> </script> <script src="Scripts/jquery-1.4.2.js" type="text/javascript"></script> <script src="Scripts/jquery.tmpl.js" type="text/javascript"></script> <script type="text/javascript"> var products = [ {name:"Milk", price:4.55}, {name:"Yogurt", price:2.99}, {name:"Steak", price:23.44} ]; $("#productTemplate").render(products).appendTo("#productContainer"); </script> </body> </html> The jQuery code in this page simply displays a list of products by using a template. I am using a jQuery template to format each product. You can learn more about using jQuery templates by reading the following blog entry by Scott Guthrie: http://weblogs.asp.net/scottgu/archive/2010/05/07/jquery-templates-and-data-linking-and-microsoft-contributing-to-jquery.aspx You can test whether the Default.htm page is working correctly by running your application (hit the F5 key). The first time that you run your application, a database is set up on your local machine to simulate cloud storage. You will see the following dialog: If the Default.htm page works as expected, you should see the list of three products: Adding an Ajax-Enabled WCF Service In the previous section, we created a simple jQuery application that displays an array by using a template. The application is a little too simple because the data is static. In this section, we’ll modify the page so that the data is retrieved from a WCF service instead of an array. First, we need to add a new Ajax-enabled WCF Service to the WebRole1 project. Select the menu option Project, Add New Item and select the Ajax-enabled WCF Service project item. Name the new service ProductService.svc. Modify the service so that it returns a static collection of products. The final code for the ProductService.svc should look like this: using System.Collections.Generic; using System.ServiceModel; using System.ServiceModel.Activation; namespace WebRole1 { public class Product { public string name { get; set; } public decimal price { get; set; } } [ServiceContract(Namespace = "")] [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] public class ProductService { [OperationContract] public IList<Product> SelectProducts() { var products = new List<Product>(); products.Add(new Product {name="Milk", price=4.55m} ); products.Add(new Product { name = "Yogurt", price = 2.99m }); products.Add(new Product { name = "Steak", price = 23.44m }); return products; } } }   In real life, you would want to retrieve the list of products from storage instead of a static array. We are being lazy here. Next you need to modify the Default.htm page to use the ProductService.svc. The jQuery script in the following updated Default.htm page makes an Ajax call to the WCF service. The data retrieved from the ProductService.svc is displayed in the client template. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Products</title> <style type="text/css"> #productContainer div { border:solid 1px black; padding:5px; margin:5px; } </style> </head> <body> <h1>Product Catalog</h1> <div id="productContainer"></div> <script id="productTemplate" type="text/html"> <div> Name: {{= name }} <br /> Price: {{= price }} </div> </script> <script src="Scripts/jquery-1.4.2.js" type="text/javascript"></script> <script src="Scripts/jquery.tmpl.js" type="text/javascript"></script> <script type="text/javascript"> $.post("ProductService.svc/SelectProducts", function (results) { var products = results["d"]; $("#productTemplate").render(products).appendTo("#productContainer"); }); </script> </body> </html>   Deploying the jQuery Application to the Cloud Now that we have created our jQuery application, we are ready to deploy our application to the cloud so that the whole world can use it. Right-click your jQueryApp project in the Solution Explorer window and select the Publish menu option. When you select publish, your application and your application configuration information is packaged up into two files named jQueryApp.cspkg and ServiceConfiguration.cscfg. Visual Studio opens the directory that contains the two files. In order to deploy these files to the Windows Azure cloud, you must upload these files yourself. Return to the Windows Azure Developers Portal at the following address: http://windows.azure.com/ Select your project and select the jQueryApp service. You will see a mysterious cube. Click the Deploy button to upload your application.   Next, you need to browse to the location on your hard drive where the jQueryApp project was published and select both the packaged application and the packaged application configuration file. Supply the deployment with a name and click the Deploy button.     While your application is in the process of being deployed, you can view a progress bar.     Running the jQuery Application in the Cloud Finally, you can run your jQuery application in the cloud by clicking the Run button.   It might take several minutes for your application to initialize (go grab a coffee). After WebRole1 finishes initializing, you can navigate to the following URL to view your live jQuery application in the cloud: http://jqueryapp.cloudapp.net/default.htm The page is hosted on the Windows Azure cloud and the WCF service executes every time that you request the page to retrieve the list of products. Summary Because we started from scratch, we needed to complete several steps to create and deploy our jQuery application to the Windows Azure cloud. We needed to create a Windows Azure account, create a hosted service, install the Windows Azure Tools for Visual Studio, create the jQuery application, and deploy it to the cloud. Now that we have finished this process once, modifying our existing cloud application or creating a new cloud application is easy. jQuery and Windows Azure work nicely together. We can take advantage of jQuery to build applications that run in the browser and we can take advantage of Windows Azure to host the backend services required by our jQuery application. The big benefit of Windows Azure is that it enables us to scale. If, all of the sudden, our jQuery application explodes in popularity, Windows Azure enables us to easily scale up to meet the demand. We can handle anything that the Internet might throw at us.

    Read the article

  • How to change Jquery UI Slider handle

    - by Tom
    I want to modify the stock JQuery UI slider so that the handle has a arrow on it rather than being a square. i.e. I want to use a custom image as the handle. There are a few tutorials that do it: http://jqueryfordesigners.com/slider-gallery/ http://www.ryancoughlin.com/2008/11/04/using-the-jquery-ui-slider/ http://www.keepthewebweird.com/creating-a-nice-slider-with-jquery-ui/ But I can't get it to work. The following code results in a stationary handle image: <!DOCTYPE html> <html> <head> <link type="text/css" href="http://jqueryui.com/latest/themes/base/ui.all.css" rel="stylesheet" /> <script type="text/javascript" src="http://jqueryui.com/latest/jquery-1.3.2.js"></script> <script type="text/javascript" src="http://jqueryui.com/latest/ui/ui.core.js"></script> <script type="text/javascript" src="http://jqueryui.com/latest/ui/ui.slider.js"></script> <style type="text/css"> #myhandle {position: absolute;z-index: 100;height: 25px;width: 35px;top: auto;background: url(http://stackoverflow.com/content/img/so/vote-arrow-down.png) no-repeat;} </style> <script type="text/javascript"> $(document).ready(function(){ $("#slider").slider({handle: '#myhandle'}); }); </script> </head> <body> <div id="slider"><div id="myhandle"></div></div> </body> </html> It is as if JQuery doesn't pick up that I want to use the myhandle id for the handle. I'm wondering: Do I need a plugin for JQuery to recognise the handle option? (it is not documented in http://docs.jquery.com/UI/Slider). Or perhaps it only worked in an old version of JQuery? Any ideas?

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >