Creativeideea - creativeideea.md - Creative Ideea
General Information:
Latest News:
keypress 7 Apr 2012 | 09:03 pm
Fadeout Slideup effect to remove an element 1 Apr 2012 | 09:49 pm
$(“#myButton”).click(function() { $(“#myDiv”).fadeTo(“slow”, 0.01, function(){ //fade $(this).slideUp(“slow”, function() { //slide up $(this).remove(); //then remove from the DOM }); }); });
Checking if an element exists 1 Apr 2012 | 09:48 pm
if ($(“#someDiv”).length) { //hooray!!! it exists… }
Get mouse cursor x and y axis 1 Apr 2012 | 09:46 pm
$().mousemove(function(e){ //display the x and y axis values inside the P element $(‘p’).html(“X Axis : ” + e.pageX + ” | Y Axis ” + e.pageY); });
Disable right-click contextual menu 1 Apr 2012 | 09:46 pm
$(document).ready(function(){ $(document).bind(“contextmenu”,function(e){ return false; }); });
Getting Parent DIV using closest 1 Apr 2012 | 09:45 pm
If you want to find the wrapping DIV element (regardless of the ID on that DIV) then you’ll want this jQuery selector: $(“#searchBox”).closest(“div”);
Center an element on the Screen 1 Apr 2012 | 09:44 pm
jQuery.fn.center = function () { this.css(“position”,”absolute”); this.css(“top”, ( $(window).height() – this.height() ) / 2+$(window).scrollTop() + “px”); this.css(“left”, ( $(window).width() – this....
Make an element to “FLASH” 1 Apr 2012 | 09:44 pm
jQuery.fn.flash = function( color, duration ) { var current = this.css( ‘color’ ); this.animate( { color: ‘rgb(‘ + color + ‘)’ }, duration / 2 ); this.animate( { color: current }, duration / 2 ); } //...
Counting immediate child elements 1 Apr 2012 | 09:43 pm
//jQuery code to count child elements $(“#foo > div”).size()
Test if something is hidden using jQuery 1 Apr 2012 | 09:42 pm
if($(element).is(“:visible”) == “true”) { //The element is Visible }