SearchRecent postsThe Random ToolboxDrupal 7 Setting up variables for use in a template (preprocess and process functions) Rendering Drupal 7 fields (the right way) Linux Secure Copy (scp) command Restrict Free Shipping in Magento Quickbooks Text Connection Ticket Cross-Site Request Forgery (CSRF) jQuery Events: MouseOver / MouseOut vs. MouseEnter / MouseLeave Monthly archive
|
jQuery animate() Example with Callback FunctionUse a callback function to display a message once the animation is completed. This snippet will animate every html element and then replace the html with the message when the #link-id element is clicked. $("#link-id").click(function() { $("p.animate").animate( {"height": "100px", "width": "250px"}, "slow", function(){ $(this).html("Animation Completed"); }); }); How to Uninstall a Module in Magento - Reinstall Magento Module and Run Install ScriptIf you want Magento to reinstall the module and re-run any database setup, take a look at the core_resource table. Delete your module from this table and DROP any tables that the module had created. Clear Magento’s cache and the module will re-install. The mysql4-install-X.X.X.php files will only be run once by Magento. By changing the version value in your XML config (Namespace/Module/etc/config.xml), you’re telling Magento which install file it should use: Vertically Align an Element with jQuery - Vertical Align an Anchor or Div//align text vertically var i = 1; // for debugging $('div.view-home-colored-circles div.view-content ul li a').each(function(){ var ah = $(this).height(); // insert the element/id/class to center within var ph = $(this).parents('li').height(); var mh = Math.ceil((ph-ah) / 2); // may choose to use margin-top - depends on your case $(this).css({'padding-top':mh}); // for debugging console.log('a position: ' + i + 'a height: ' + ah + 'li height:' + ph + 'p Browser and Operating System (OS) Detection with Javascriptvar BrowserDetect = { init: function () { this.browser = this.searchString(this.dataBrowser) || "An unknown browser"; this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "an unknown version"; this.OS = this.searchString(this.dataOS) || "an unknown OS"; }, searchString: function (data) { for (var i=0;i<data.length;i++) { var dataString = data[i].string; var dataProp = data[i].prop; this.versionSearchString = data[i].versionSearch || data[i].identity; if (dataString) { if (dataString. Show SKU in Cart Module - UbercartCreate a folder in your modules directory named uc_show_sku and add these files. IE7 Hide Link Text and Leave Link Clickable - IE7 Text-Indent Effectline-height: 0; font-size: 0; color: transparent; .htaccess 301 Redirect to Different DomainOptions +FollowSymlinks RewriteEngine on rewritecond %{http_host} ^domain.com [nc] rewriterule ^(.*)$ http://www.newdomain.com/$1 [r=301,nc] A Javascript Playground - JsFiddleJsFiddle is a playground for web developers, a tool which may be used in many ways. One can use it as an online editor for snippets build from HTML, CSS and JavaScript. The code can then be shared with others, embedded on a blog, etc. Using this approach, JavaScript developers can very easily isolate bugs. We aim to support all actively developed frameworks - it helps with testing compatibility. Use jQuery to hide a DIV when the user clicks outside of it$('div#personalize-window').hover(function(){ mouse_is_inside = true; }, function() { mouse_is_inside=false; }); $("body").mouseup(function(){ if(! mouse_is_inside) $('div#personalize-window').fadeOut('slow'); }); Mobile Version of WebsiteTo implement our changes, we first set the viewport to the device's width. Do this by inserting the following line of code into the head of your XHTML template: |