ShareThis

Showing posts with label Code. Show all posts
Showing posts with label Code. Show all posts

Friday, December 28, 2012

Speed up your HTML/CSS with Zen Coding

Here is a video of a new tool available for writing less HTML and getting MORE out of it! The system works by allowing you to enter abbreviations of tags with attributes, even child nodes, and expand them into actual HTML. Looks pretty nifty, definitely going to give this a try.



 You can read more about it and get the download in the Smashing Magazine article.

Tuesday, October 30, 2012

jQuery/js Mouse drag select code (No plugin required!)


Here is a nifty script to allow you to drag mouse-down over html tables. Works for any sort of table as long as you specify the tr's.
 
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<script type="text/javascript">
    
 $(function () {
      var isMouseDown = false;
      $("#yourTableId tr").not(":first")
        .mousedown(function () {
          isMouseDown = true; 
 
 // Put your mouse-down logic here (i.e. highlighting the tr)
 
          return false; // prevent text selection
        })
        .mouseover(function () {
          if (isMouseDown) {
 
  // Put your drag-over logic here (i.e. highlighting the tr)
 
          }
        })
        .bind("selectstart", function () {
          return false; // prevent text selection in IE
        });

      $(document)
        .mouseup(function () {
          isMouseDown = false;
        });
    });
</script>