Search Results

Search found 23820 results on 953 pages for 'jquery ui autocomplete'.

Page 45/953 | < Previous Page | 41 42 43 44 45 46 47 48 49 50 51 52  | Next Page >

  • Building a jQuery Plug-in to make an HTML Table scrollable

    - by Rick Strahl
    Today I got a call from a customer and we were looking over an older application that uses a lot of tables to display financial and other assorted data. The application is mostly meta-data driven with lots of layout formatting automatically driven through meta data rather than through explicit hand coded HTML layouts. One of the problems in this apps are tables that display a non-fixed amount of data. The users of this app don't want to use paging to see more data, but instead want to display overflow data using a scrollbar. Many of the forms are very densely populated, often with multiple data tables that display a few rows of data in the UI at the most. This sort of layout does not lend itself well to paging, but works much better with scrollable data. Unfortunately scrollable tables are not easily created. HTML Tables are mangy beasts as anybody who's done any sort of Web development knows. Tables are finicky when it comes to styling and layout, and they have many funky quirks, especially when it comes to scrolling both of the table rows themselves or even the child columns. There's no built-in way to make tables scroll and to lock headers while you do, and while you can embed a table (or anything really) into a scrolling div with something like this: <div style="position:relative; overflow: hidden; overflow-y: scroll; height: 200px; width: 400px;"> <table id="table" style="width: 100%" class="blackborder" > <thead> <tr class="gridheader"> <th>Column 1</th> <th>Column 2</th> <th>Column 3</th> <th >Column 4</th> </tr> </thead> <tbody> <tr> <td>Column 1 Content</td> <td>Column 2 Content</td> <td>Column 3 Content</td> <td>Column 4 Content</td> </tr> <tr> <td>Column 1 Content</td> <td>Column 2 Content</td> <td>Column 3 Content</td> <td>Column 4 Content</td> </tr> … </tbody> </table> </div> </div> that won't give a very satisfying visual experience: Both the header and body scroll which looks odd. You lose context as soon as the header scrolls off the top and when you reach the bottom of the list the bottom outline of the table shows which also looks off. The the side bar shows all the way down the length of the table yet another visual miscue. In a pinch this will work, but it's ugly. What's out there? Before we go further here you should know that there are a few capable grid plug-ins out there already. Among them: Flexigrid (can work of any table as well as with AJAX data) jQuery Scrollable Table Plug-in (feature similar to what I need but not quite) jqGrid (mostly an Ajax Grid which is very powerful and works very well) But in the end none of them fit the bill of what I needed in this situation. All of these require custom CSS and some of them are fairly complex to restyle. Others are AJAX only or work better with AJAX loaded data. However, I need to actually try (as much as possible) to maintain the original styling of the tables without requiring extensive re-styling. Building the makeTableScrollable() Plug-in To make a table scrollable requires rearranging the table a bit. In the plug-in I built I create two <div> tags and split the table into two: one for the table header and one for the table body. The bottom <div> tag then contains only the table's row data and can be scrolled while the header stays fixed. Using jQuery the basic idea is pretty simple: You create the divs, copy the original table into the bottom, then clone the table, clear all content append the <thead> section, into new table and then copy that table into the second header <div>. Easy as pie, right? Unfortunately it's a bit more complicated than that as it's tricky to get the width of the table right to account for the scrollbar (by adding a small column) and making sure the borders properly line up for the two tables. A lot of style settings have to be made to ensure the table is a fixed size, to remove and reattach borders, to add extra space to allow for the scrollbar and so forth. The end result of my plug-in is a table with a scrollbar. Using the same table I used earlier the result looks like this: To create it, I use the following jQuery plug-in logic to select my table and run the makeTableScrollable() plug-in against the selector: $("#table").makeTableScrollable( { cssClass:"blackborder"} ); Without much further ado, here's the short code for the plug-in: (function ($) { $.fn.makeTableScrollable = function (options) { return this.each(function () { var $table = $(this); var opt = { // height of the table height: "250px", // right padding added to support the scrollbar rightPadding: "10px", // cssclass used for the wrapper div cssClass: "" } $.extend(opt, options); var $thead = $table.find("thead"); var $ths = $thead.find("th"); var id = $table.attr("id"); var cssClass = $table.attr("class"); if (!id) id = "_table_" + new Date().getMilliseconds().ToString(); $table.width("+=" + opt.rightPadding); $table.css("border-width", 0); // add a column to all rows of the table var first = true; $table.find("tr").each(function () { var row = $(this); if (first) { row.append($("<th>").width(opt.rightPadding)); first = false; } else row.append($("<td>").width(opt.rightPadding)); }); // force full sizing on each of the th elemnts $ths.each(function () { var $th = $(this); $th.css("width", $th.width()); }); // Create the table wrapper div var $tblDiv = $("<div>").css({ position: "relative", overflow: "hidden", overflowY: "scroll" }) .addClass(opt.cssClass); var width = $table.width(); $tblDiv.width(width).height(opt.height) .attr("id", id + "_wrapper") .css("border-top", "none"); // Insert before $tblDiv $tblDiv.insertBefore($table); // then move the table into it $table.appendTo($tblDiv); // Clone the div for header var $hdDiv = $tblDiv.clone(); $hdDiv.empty(); var width = $table.width(); $hdDiv.attr("style", "") .css("border-bottom", "none") .width(width) .attr("id", id + "_wrapper_header"); // create a copy of the table and remove all children var $newTable = $($table).clone(); $newTable.empty() .attr("id", $table.attr("id") + "_header"); $thead.appendTo($newTable); $hdDiv.insertBefore($tblDiv); $newTable.appendTo($hdDiv); $table.css("border-width", 0); }); } })(jQuery); Oh sweet spaghetti code :-) The code starts out by dealing the parameters that can be passed in the options object map: height The height of the full table/structure. The height of the outside wrapper container. Defaults to 200px. rightPadding The padding that is added to the right of the table to account for the scrollbar. Creates a column of this width and injects it into the table. If too small the rightmost column might get truncated. if too large the empty column might show. cssClass The CSS class of the wrapping container that appears to wrap the table. If you want a border around your table this class should probably provide it since the plug-in removes the table border. The rest of the code is obtuse, but pretty straight forward. It starts by creating a new column in the table to accommodate the width of the scrollbar and avoid clipping of text in the rightmost column. The width of the columns is explicitly set in the header elements to force the size of the table to be fixed and to provide the same sizing when the THEAD section is moved to a new copied table later. The table wrapper div is created, formatted and the table is moved into it. The new wrapper div is cloned for the header wrapper and configured. Finally the actual table is cloned and cleared of all elements. The original table's THEAD section is then moved into the new table. At last the new table is added to the header <div>, and the header <div> is inserted before the table wrapper <div>. I'm always amazed how easy jQuery makes it to do this sort of re-arranging, and given of what's happening the amount of code is rather small. Disclaimer: Your mileage may vary A word of warning: I make no guarantees about the code above. It's a first cut and I provided this here mainly to demonstrate the concepts of decomposing and reassembling an HTML layout :-) which jQuery makes so nice and easy. I tested this component against the typical scenarios we plan on using it for which are tables that use a few well known styles (or no styling at all). I suspect if you have complex styling on your <table> tag that things might not go so well. If you plan on using this plug-in you might want to minimize your styling of the table tag and defer any border formatting using the class passed in via the cssClass parameter, which ends up on the two wrapper div's that wrap the header and body rows. There's also no explicit support for footers. I rarely if ever use footers (when not using paging that is), so I didn't feel the need to add footer support. However, if you need that it's not difficult to add - the logic is the same as adding the header. The plug-in relies on a well-formatted table that has THEAD and TBODY sections along with TH tags in the header. Note that ASP.NET WebForm DataGrids and GridViews by default do not generate well-formatted table HTML. You can look at my Adding proper THEAD sections to a GridView post for more info on how to get a GridView to render properly. The plug-in has no dependencies other than jQuery. Even with the limitations in mind I hope this might be useful to some of you. I know I've already identified a number of places in my own existing applications where I will be plugging this in almost immediately. Resources Download Sample and Plug-in code Latest version in the West Wind Web & AJAX Toolkit Repository © Rick Strahl, West Wind Technologies, 2005-2011Posted in jQuery  HTML  ASP.NET  

    Read the article

  • jQuery jqGrid TreeGrid not functionining properly

    - by Raul Agrait
    Hello. I am having trouble constructing a jqGrid TreeGrid using local data. This method works just fine as a regular grid if you comment out the treeGrid and ExpandColumn attributes, but once you add those to try to make it a tree grid, it doesn't create the tree grid, and it no longer sorts properly. jQuery(function(){ var gridOptions = { datatype: "local", height: 250, colNames: ['Name', 'Type', 'Last Modified On', 'Last Modified By'], colModel: [{name: 'name', index: 'name', width: 200, sorttype: 'text'}, {name: 'type', index: 'type', width: 200, sorttype: 'text'}, {name: 'modifiedon', index: 'modifiedon', width: 200, sorttype: 'date'}, {name: 'modifiedby', index: 'modifiedby', width: 200, sorttype: 'text'}], treeGrid: true, ExpandColumn: 'name', caption: "My Grid" }; jQuery("#treeGrid").jqGrid(gridOptions); var gridData = [ {name: "My File", type: "My File Type", modifiedon: "03/10/2010", modifiedby"Strong Sad", lft: "1", rgt: "8", level: "0"}, {name: "One of Everything", type: "Word Document", modifiedon: "02/12/2009", modifiedby: "Strong Bad", lft: "2", rgt: "5", level: "0"}, {name: "My Presentation", type: "PowerPoint", modifiedon: "01/23/2009", modifiedby: "The Cheat", lft: "3", rgt: "4", level: "0"} ]; for (var i = 0; i < gridData.length; i++) { jQuery("#treeGrid").jqGrid('addRowData', i + 1, gridData[i]); } });

    Read the article

  • Slimbox 2 Plugin, jQuery Flickr, and IE8

    - by Nick H.
    Hello, I am currently developing a site that I make use of two jQuery plugins: Flickr jquery plugin (http://code.google.com/p/jquery-flickr/) Slimbox (http://code.google.com/p/slimbox/) The first plugin is used to pull in flickr photos from a specific account. These photos are displayed as thumbnails on the page. I am then using the second plugin to display larger views of these images. Because the flickr photos are fetched when the page loads, I am calling the Slimbox 2 function like this: $(document).ready(function() { $("#Flickr").flickr(); //Call Flickr plugin $(window).bind('load', function() { $("#Flickr a").slimbox();//Call Slimbox2 }); }); On first testing this seemed to have worked perfectly. I tested multiple versions of FireFox, IE7, IE6, and Safari. Everything is great. However, the Slimbox lightbox effest does not work in IE8. However, if I put IE8 into compatibility mode, everything works as expected. I would like to avoid forcing compatibility mode. There are no javascript errors and I am at a loss for testing. Here is a link to a sample: http://www.njhall.com/JRMcCourt-Builders/index.html#ourwork Any advice would be greatly appreciated. Thanks Nick

    Read the article

  • Why isn't jQuery automatically appending the JSONP callback?

    - by Aseem Kishore
    The $.getJSON() documentation states: If the specified URL is on a remote server, the request is treated as JSONP instead. See the discussion of the jsonp data type in $.ajax() for more details. The $.ajax() documentation for the jsonp data type states (emphasis mine): Loads in a JSON block using JSONP. Will add an extra "?callback=?" to the end of your URL to specify the callback. So it seems that if I call $.getJSON() with a cross-domain URL, the extra "callback=?" parameter should automatically get added. (Other parts of the documentation support this interpretation.) However, I'm not seeing that behavior. If I don't add the "callback=?" explicitly, jQuery incorrectly makes an XMLHttpRequest (which returns null data since I can't read the response cross-domain). If I do add it explicitly, jQuery correctly makes a <script> request. Here's an example: var URL = "http://www.geonames.org/postalCodeLookupJSON" + "?postalcode=10504&country=US"; function alertResponse(data, status) { alert("data: " + data + ", status: " + status); } $.getJSON(URL, alertResponse); // alerts "data: null, status: success" $.getJSON(URL + "&callback=?", alertResponse); // alerts "data: [object Object], status: undefined" So what's going on? Am I misunderstanding the documentation or forgetting something? It goes without saying that this isn't a huge deal, but I'm creating a web API and I purposely set the callback parameter to "callback" in the hopes of tailoring it nicely to jQuery usage. Thanks!

    Read the article

  • jquery selector logical AND?

    - by taber
    In jQuery I'm trying to select only mount nodes where a and b's text values are 64 and "test" accordingly. I'd also like to fallback to 32 if no 64 and "test" exist. What I'm seeing with the code below though, is that the 32 mount is being returned instead of the 64. The XML: <thingses <thing <a32</a <-- note, a here is 32 and not 64 -- <other...</other <mountsample 1</mount <btest</b </thing <thing <a64</a <other...</other <mountsample 2</mount <btest</b </thing <thing <a64</a <other...</other <mountsample 3</mount <bunrelated</b </thing <thing <a128</a <other...</other <mountsample 4</mount <bunrelated</b </thing </thingses And unfortunately I don't have control over the XML as it comes from somewhere else. What I'm doing now is: var ret_val = ''; $data.find('thingses thing').each(function(i, node) { var $node = $(node), found_node = $node.find('b:first:is(test), a:first:is(64)').end().find('mount:first').text(); if(found_node) { ret_val = found_node; return; } found_node = $node.find('b:first:is(test), a:first:is(32)').end().find('mount:first').text(); if(found_node) { ret_val = found_node; return; } ret_val = 'not found'; }); // expected result is "sample 2", but if sample 2's parent "thing" was missing, the result would be "sample 1" alert(ret_val); For my ":is" selector I'm using: if(jQuery){ jQuery.expr[":"].is = function(obj, index, meta, stack){ return (obj.textContent || obj.innerText || $(obj).text() || "").toLowerCase() == meta[3].toLowerCase(); }; } There has to be a better way than how I'm doing it. I wish I could replace the "," with "AND" or something. :) Any help would be much appreciated. thanks!

    Read the article

  • jQuery ajax call doesn't seem to do anything at all

    - by icemanind
    I am having a problem with making an ajax call in jQuery. Having done this a million times, I know I am missing something really silly here. Here is my javascript code for making the ajax call: function editEmployee(id) { $('#<%= imgNewEmployeeWait.ClientID %>').hide(); $('#divAddNewEmployeeDialog input[type=text]').val(''); $('#divAddNewEmployeeDialog select option:first-child').attr("selected", "selected"); $('#divAddNewEmployeeDialog').dialog('open'); $('#createEditEmployeeId').text(id); var inputEmp = {}; inputEmp.id = id; var jsonInputEmp = JSON.stringify(inputEmp); debugger; alert('Before Ajax Call!'); $.ajax({ type: "POST", url: "Configuration.aspx/GetEmployee", data: jsonInputEmp, contentType: "application/json; charset=utf-8", dataType: "json", success: function (msg) { alert('success'); }, error: function (msg) { alert('failure'); } }); } Here is my CS code that is trying to be called: [WebMethod] public static string GetEmployee(int id) { var employee = new Employee(id); return Newtonsoft.Json.JsonConvert.SerializeObject(employee, Newtonsoft.Json.Formatting.Indented); } When I try to run this, I do get the alert that says Before Ajax Call!. However, I never get an alert back that says success or an alert that says failure. I did go into my CS code and put a breakpoint on the GetEmployee method. The breakpoint did hit, so I know jQuery is successfully calling the method. I stepped through the method and it executed just fine with no errors. I can only assume the error is happening when the jQuery ajax call is returning from the call. Also, I looked in my event logs just to make sure there wasn't an ASPX error occurring. There is no error in the logs. I also looked at the console. There are no script errors. Anyone have any ideas what I am missing here? `

    Read the article

  • when updating location.hash in Chrome the jQuery animation "freezes" for a second

    - by ubunut
    I'm trying to create a sort of "virtual gallery". I'm using Coda Slider 2.0 & jQuery v1.4.2 It behaves perfectly in IE, FF & Safari, but Chrome seems to reload/hang for a second when setting location.hash. This causes the jQuery animation to freeze for a second :S Example: http://hardyernst.dk/gallery.html try clicking on the navigation links above the pictures. The jQuery code that is being executed when clicking a navigation link: $('#coda-nav-' + sliderCount + ' a').each(function(z) { // What happens when a nav link is clicked $(this).bind("click", function() { offset = -(panelWidth*z); navClicks++; $(this).addClass('current').parents('ul').find('a').not($(this)).removeClass('current'); alterPanelHeight(z); currentPanel = z + 1; $('.panel-container', slider).stop().animate({ left: offset }, settings.slideEaseDuration, settings.slideEaseFunction, function(){ if (!settings.crossLinking) { return false; } // Don't change the URL hash unless cross-linking is specified }); }); }); if I add return false; at the end of the function. The animation will slide smoothly :)... BUT as you might have guessed the location.hash value remains unchanged :( I have tried setting the location.hash earlier in the function alas it did not change the behavior in Chrome Would be immensely grateful for any help :) Regards Ubunut

    Read the article

  • jquery question for events

    - by OM The Eternity
    I have to copy the text from one text box to another using checkbox through jquery I have applied jquery event in my code, it works partially correct.. code is as follows: <html> <head> <script src="js/jquery.js" ></script> </head> <body> <form> <input type="text" name="startdate" id="startdate" value=""/> <input type="text" name="enddate" id="enddate" value=""/> <input type="checkbox" name="checker" id="checker" /> </form> <script> $(document).ready(function(){ $("#startdate").change(function(o){ if($("#checker").is(":checked")){ $("#enddate").val($("#startdate").val()); } }); }); </script> </body> </html> this code works as follows, I always have checkbox checked by default hence whenever i insert the start date and then tab, the start date gets copied to enddate. My Problem but now if uncheck the checkbox and change the start date and then recheck the check box, the start date is not copied, Now what should be done in this situation.. please help me....

    Read the article

  • jQuery - Callback failing if there is no options parameter

    - by user249950
    Hi, I'm attempting to build a simple plugin like this (function($) { $.fn.gpSlideOut = function(options, callback) { // default options - these are used when no others are specified $.fn.gpSlideOut.defaults = { fadeToColour: "#ffffb3", fadeToColourSpeed: 500, slideUpSpeed: 400 }; // build main options before element iteration var o = $.extend({}, $.fn.gpSlideOut.defaults, options); this.each(function() { $(this) .animate({backgroundColor: o.fadeToColour},o.fadeToColourSpeed) .slideUp(o.SlideUpSpeed, function(){ if (typeof callback == 'function') { // make sure the callback is a function callback.call(this); // brings the scope to the callback } }); }); return this; }; // invoke the function we just created passing it the jQuery object })(jQuery); The confusion I'm having is that normally on jQuery plugins you can call something like this: $(this_moveable_item).gpSlideOut(function() { // Do stuff }); Without the options parameter, but it misses the callback if I do it like that so I have to always have var options = {} $(this_moveable_item).gpSlideOut(options, function() { // Do stuff }); Even if I only want to use the defaults. Is there anyway to make sure the callback function is called whether or not the options parameter is there? Cheers.

    Read the article

  • jquery child selector problems

    - by codedude
    I have a basic website nav layout that looks like this: <li class="folder parent_folder"> <a href="#">Some Folder</a> <ul class="submenu"> <li class="file"><a href="#">An awesome file</a></li> <li class="file"><a href="#">An awesome file</a></li> <li class="file"><a href="#">An awesome file</a></li> <li class="file"><a href="#">An awesome file</a></li> <li class="file"><a href="#">An awesome file</a></li> <li class="file"><a href="#">An awesome file</a></li> </ul> I have several of these throughout the site's page. Using jquery, I'm trying to make it so that when you click "li.parent_folder" "ul.submenu" disappears and then reappears when you click "li.parent_folder" again. I can get it to do this but I have a problem. When I click on the "li.parent_folder" all the "ul.submenu" disapear instead of just the one that is the child of it. What would be the correct jquery code to accomplish this? (Oh, I'm using jquery ui also in this project What I have right now is this: $('li.parent_folder').click(function() { $('li.parent_folder ul.submenu').hide(); });

    Read the article

  • How to jQuery plugin effects to items created later in the DOM

    - by Dan Denney
    How do I apply jQuery plugin effects to items that are created by an event? So, what I am attempting to do is have all uls throughout a site use the jquery.scroll.js plugin for styling. I currently have it working on all active uls. However, there are some category/subcategory sections. I am still new to writing any jQuery on my own and there is a leap in logic that I don't understand on applying plugins to items when they are loaded later. In the real example, users click a category from a ul and a sub category is loaded via Rails and JSON. For a light sample, I made a jsfiddle that simulates the issue that I run into. The category ul is styled correctly, but the subcategory ul doesn't pick up the styling. I'm hoping for some assistance not just in whipping up some code to fix it, but in pointing me in the direction of what I need to learn for this functionality. http://jsfiddle.net/dandenney/25R8F/1/ Thank you in advance!

    Read the article

  • Calling a jQuery method at declaration time, and then onEvent

    - by cesarsalazar
    I've been writing JS (mainly jQuery) for quite a few months now, but today I decided to make my first abstraction as a jQuery method. I already have working code but I feel/know that I'm not doing it the right way, so I come here for some enlightenment. Note: Please do not reply that there's already something out there that does the trick as I already know that. My interest in this matter is rather educational. What my code is intended to do (and does): Limit the characters of a textfield and change the color of the counter when the user is approaching the end. And here's what I have: $(function(){ $('#bio textarea').keyup(function(){ $(this).char_length_validation({ maxlength: 500, warning: 50, validationSelector: '#bio .note' }) }) $('#bio textarea').trigger('keyup'); }) jQuery.fn.char_length_validation = function(opts){ chars_left = opts.maxlength - this.val().length; if(chars_left >= 0){ $(opts.validationSelector + ' .value').text(chars_left); if(chars_left < opts.warning){ $(opts.validationSelector).addClass('invalid'); } else{ $(opts.validationSelector).removeClass('invalid'); } } else{ this.value = this.value.substring(0, opts.maxlength); } } In the HTML: <div id="bio"> <textarea>Some text</textarea> <p class="note> <span class="value">XX</span> <span> characters left</span> </p> </div> Particularly I feel really uncomfortable binding the event each on each keyup instead of binding once and calling a method later. Also, (and hence the title) I need to call the method initially (when the page renders) and then every time the user inputs a character. Thanks in advance for your time :)

    Read the article

  • Error occurs while validating form input using jQuery in Firebug

    - by Param-Ganak
    I have written a custom validation code in jQuery, which is working fine. I have a login form which has two fields, i.e. userid and password. I have written a custom code for client side validation for these fields. This code is working fine and gives me proper error messages as per the situation. But the problem with this code is that when I enter the invalid data in any or both field and press submit button of form then it displays the proper error message but at the same time when I checked it in Firebug it displays following error message when submit button of the form is clicked validate is not defined function onclick(event) { javascript: return validate(); } (click clientX=473, clientY=273) Here is the JQUERY validation code $(document).ready(function (){ $("#id_login_form").validate({ rules: { userid: { required: true, minlength: 6, maxlength: 20, // basic: true }, password: { required: true, minlength: 6, maxlength: 15, // basic: true } }, messages: { userid: { required: " Please enter the username.", minlength: "User Name should be minimum 6 characters long.", maxlength: "User Name should be maximum 15 characters long.", // basic: "working here" }, password: { required: " Please enter the password.", minlength: "Password should be minimum 6 characters long.", maxlength: "Password should be maximum 15 characters long.", // basic: "working here too.", } }, errorClass: "errortext", errorLabelContainer: "#messagebox" } }); }); /* $.validator.addMethod('username_alphanum', function (value) { return /^(?![0-9]+$)[a-zA-Z 0-9_.]+$/.test(value); }, 'User name should be alphabetic or Alphanumeric and may contain . and _.'); $.validator.addMethod('alphanum', function (value) { return /^(?![a-zA-Z]+$)(?![0-9]+$)[a-zA-Z 0-9]+$/.test(value); }, 'Password should be Alphanumeric.'); $.validator.addMethod('basic', function (value) { return /^[a-zA-Z 0-9_.]+$/.test(value); }, 'working working working'); */ So please tell me where is I am wrong in my jQuery code. Thank You!

    Read the article

  • CSS horizontal scrolling overflow with jQuery slider

    - by Jeffrey
    I'm trying to setup a full screen jquery slider. I've broken the project into two steps 1) css and 2) js. 1) CSS, below is a picture of what I'm shooting for (no fixed height) and below that is the code I have so far that doesn't work. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <style type="text/css"> /* Positioning */ #container { width: 2500px; } .block { display: inline; } /* Styling */ .block img { padding: 5px; } </style> </head> <body> <div id="container"> <div class="block"><img src="http://i42.tinypic.com/1zp2poz.gif"></div> <div class="block"><img src="http://i42.tinypic.com/1zp2poz.gif"></div> <div class="block"><img src="http://i42.tinypic.com/1zp2poz.gif"></div> </div> </body> </html> 2) Javascript, using jquery I'd like the divs to slide left when clicked on them... like the jQuery Coda Slider if possible. Thanks, any help is appreciated.

    Read the article

  • How can I load an external jQuery gallery/slideshow into a div

    - by DanTransformer
    Ive got a jQuery navigation menu loading external content into my #main div, which works fine when the content is static, but the site im working on contains jQuery galleries/slideshows which id like to call into the div. The problem im having is when the gallery is loaded, the images all appear but the jQuery functionality does not work. Any help appreciated. here is the javascript im using... $(document).ready(function() { // Check for hash value in URL var hash = window.location.hash.substr(1); var href = $('#accordion ul li a').each(function(){ var href = $(this).attr('href'); if(hash==href.substr(0,href.length-5)){ var toLoad = hash+'.html #main'; $('#main').load(toLoad) } }); $('#accordion ul li a').click(function(){ var toLoad = $(this).attr('href')+' #main'; $('#main').hide('fast',loadContent); $('#load').remove(); $('#wrapper').append('<span id="load">LOADING...</span>'); $('#load').fadeIn('normal'); window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-5); function loadContent() { $('#main').load(toLoad,'',showNewContent()) } function showNewContent() { $('#main').show('normal',hideLoader()); } function hideLoader() { $('#load').fadeOut('normal'); } return false; }); });

    Read the article

  • Building simple jQuery plugin, need assistance

    - by kirisu_kun
    Hi there, I'm building my first ever jQuery plugin (it's just a simple experiment). Here's what I have so far: (function($){ $.fn.extend({ auchieFader: function(options) { var defaults = { mask: '', topImg : '', } var options = $.extend(defaults, options); return this.each(function() { var o = options; var obj = $(this); var masker = $(o.mask, obj); masker.hover(function () { $(o.topImg).stop().animate({ "opacity": "0" }, "slow"); }, function () { $(o.topImg).stop().animate({ "opacity": "1" }, "slow"); }); }); } }); })(jQuery); I'm then calling the plugin using: $('.fader').auchieFader({mask: ".mask", topImg: ".top"}); If I then add another request say: $('.fader2').auchieFader({mask: ".mask", topImg: ".top"}); Then no matter what instance of my 2 faders I hover both of them will trigger. I know this is because my mask mask and topImg options have the same class - but how can I modify the plugin to allow for these items to have the same class? I know it's probably something really simple, but I'm still finding my way with jQuery and Javascript in general. Any other tips on improving my code would also be greatly appreciated! Cheers, Chris

    Read the article

  • jQuery plugin Private functions inside Vs. Outside the each loop

    - by Pablo
    What is the difference between including private functions in a jQuery plugin in the examples below: Outside the loop: (function( $ ){ var defaults = {}; $.fn.cmFlex = function(opts) { this.each(function() { var $this = $(this); //Element specific options var o = $.extend({}, defaults, opts); //Code here }); function f1(){.... function f3(){.... function f2(){.... }; })( jQuery ); Inside the loop: (function( $ ){ var defaults = {}; $.fn.cmFlex = function(opts) { this.each(function() { var $this = $(this); //Element specific options var o = $.extend({}, defaults, opts); function f1(){.... function f3(){.... function f2(){.... }); }; })( jQuery ); The advantage of including the functions in the loop is that i will be able to access the $this variable as well as the Element specific options from f1() f2() f3(), are there any disadvantages to this?

    Read the article

  • select dropdown option by value using jquery

    - by user1765862
    I have select following html structure <select id="mainMenu" data-mini="true" name="select-choice-min"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> </select> on page load I want initially set option with value 5 so I tried (but nothing changed) $(document).ready(function () { $('#mainMenu option').eq(5).prop('selected', true); }) I'm using jquery 1.8.3 and jqueyr mobile since this is mobile website <script src="/Scripts/jquery-1.8.3.js"></script> <script src="/Scripts/jquery.mobile-1.4.2.js"></script> UPDATE: I just realize that every code from posted answers works (as well as mine), #mainMenu option value is set to desired value (5) but it's text doesnt change (in any of this scenarios). Is this normal and is there workarround for this. I tried $("mainMenu").text("5");

    Read the article

  • jquery full calendar

    - by madrat
    hello everybody. I am new to fullCalendar and i do not kno how to use gotoDate method. What i have is a tabbed page with 12 tabs (every tab is a month of the year). What i need is when i load jquery calendar, foreach tab, the calendar to switch to the month that is assigned. (e.g when i click and load page for January the calendar shows days for january, and so on). thanks for your help.

    Read the article

  • Jquery Tabs 1.8 ajax content > #history problem

    - by Gaston
    Hey! I'm trying to load jQuery content in the same container (div#realContent) and it seems that when I use the a 'title' to enter the div ID (all links the same title) the history stop working. You can enter here http://home.d23.com.uy/fermata/ user: fermata pass: fermata , and see what I mean. Thanks

    Read the article

  • Cant get flexigrid to work in Jquery Tools Tab

    - by John
    Im fairly new to jquery and Im using jquery tools for tabs. I am wanting in one of the tabs to show flexigrid, but when I try to do this flexigrid does not show up, its just blank. If I setup flexigrid in a stand alone page outside the tab it works just fine. Below is the code that isnt working. Again Im new so please go easy! <ul class="css-tabs"> <li><a href="#details">Account Details</a></li> <li><a href="#accounts">Sub Accounts</a></li> <li><a href="#groups">Groups</a></li> <li><a href="#support">Tickets</a></li> </ul> <div class="css-panes"> <div>Tab 1</div> <div><table id="flex1" style="display:none"></table></div> <div>Tab 3</div> <div>Tab 4</div> </div> <script> $(function() { $("ul.css-tabs").tabs("div.css-panes > div").history(); }); $('.flexme1').flexigrid(); $('.flexme2').flexigrid({height:'auto',striped:false}); $("#flex1").flexigrid ( { url: '/accounts_list.php', dataType: 'json', colModel : [ {display: 'ID', name : 'id', width : 45, sortable : true, align: 'center'}, {display: 'Username', name : 'username', width : 120, sortable : true, align: 'left'}, {display: 'Display Name', name : 'displayname', width : 150, sortable : true, align: 'left'}, {display: 'Limit', name : 'accounts', width : 50, sortable : true, align: 'center'}, {display: 'Rate', name : 'charge', width : 50, sortable : true, align: 'center'}, {display: 'Subs', name : 'subcount', width : 50, sortable : true, align: 'center'} ], searchitems : [ {display: 'ID', name : 'id'}, {display: 'Username', name : 'username', isdefault: true}, {display: 'Display Name', name : 'displayname'} ], sortname: "id", sortorder: "desc", usepager: true, singleSelect: true, title: 'Test', useRp: true, rp: 20, showTableToggleBtn: false, width: 500, height: 250 }); </script>

    Read the article

  • Jquery Dialog - div disappears after initialization

    - by Zuber
    JQuery Dialog is giving me lots of pain lately. I have the following div which I want to be popped up. (Ignore that the classes do not show the double quotes in the syntax) TABLE class=widget-title-table border=0 cellSpacing=0 cellPadding=0> <TBODY> <TR> <TD class=widget-title><SPAN class=widget-title>Basic Info</SPAN></TD> <TD class=widget-action> <DIV id=edit-actions jQuery1266325647362="3"> <UL class="linkbutton-menu read-mode"> <LI class="control-actions"> <A id="action-button" class="mouse-over-pointer linkbutton">Delete this stakeholder</A> <DIV id="confirmation" class="confirmation-dialog title=Confirmation"> Are you sure you want to delete this stakeholder? </DIV> </LI></UL></DIV></TD></TR></TBODY></TABLE> The JQuery for this is ... $(document).ready(function() { $('#confirmation').dialog({ bgiframe: true, modal: true, autoOpen: false, closeOnEscape: false, draggable: true, position: 'center', resizable: false, width: 400, height: 150 }); }); And the dialog is 'open'ed by var confirmationBox = $('#confirmation',actionContent); if (confirmationBox.length > 0) { //Confirmation Needed $(confirmationBox).dialog('option', 'buttons', { 'No': function() { $(this).dialog('close'); }, 'Yes': function() { $('ul.read-mode').hide(); $.post(requestUrl, {}, ActionCallback(context[0], renderFormUrl), 'json'); $(this).dialog('close'); } }); $(confirmationBox).dialog('open'); } The problem starts in the initialization itself. When the document loads, the <div #confirmation> is deleted from the markup! I had a similar issue earlier, but I cannot use that solution here. On this page I can have multiple PopUp divs. When I added the initialization in just before opening it; the form popped up. But after I close it, the div is removed; so I am not able to see the popup again.

    Read the article

  • Help with jQuery Traversal

    - by Jack Webb-Heller
    Hi guys, I'm struggling a bit with traversing in jQuery. Here's the relevant markup: <ul id="sortable" class="ui-sortable"> <li> <img src="http://ecx.images-amazon.com/images/I/51Vza76tCxL._SL160_.jpg"> <div class="controls"> <span class="move">?</span> <span class="delete">?</span> </div> <div class="data"> <h1>War and Peace (Oxford World's Classics)</h1> <textarea>Published to coincide with the centenary of Tolstoy's death, here is an exciting new edition of one of the great literary works of world literature.</textarea> </div> </li> <li> <img src="http://ecx.images-amazon.com/images/I/51boZxm2seL._SL160_.jpg"> <div class="controls"> <span class="move">?</span> <span class="delete">?</span> </div> <div class="data"> <h1>A Christmas Carol and Other Christmas Writings (Penguin Classics)</h1> <span>Optionally, write your own description in the box below.</span> <textarea>Dicken's Christmas writings-in a new, sumptuous, and delightful clothbound edition.</textarea> </div> </li> </ul> This is code for a jQuery UI 'Sortable' element. Here's what I want to happen. When the Delete thing is clicked ($('.delete')), I want the <li> item it's contained within to be removed. I've tried using $('.delete').parent().parent().remove(); but in the case of having two items, that seems to delete both of them. I'm a bit confused by this. I also tried using closest() to find the closest li, but that didn't seem to work either. How should I best traverse the DOM in this case? Thanks! Jack

    Read the article

< Previous Page | 41 42 43 44 45 46 47 48 49 50 51 52  | Next Page >