This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

Showing posts with label JQuery. Show all posts
Showing posts with label JQuery. Show all posts

Saturday, 7 December 2013

Google Maps Autoscroll Sidebar

Many of the Google Maps you see embedded on web pages are accompanied by a list of the items that are plotted on the map - sometimes referred to as a sidebar. Often, the items in the sidebar are links that enable the user to see where that item is located.

In this section, we're going to add a sidebar to the page we built in the previous section that read and plotted points stored in an JSON . This sidebar will list the names of the candidate cities as links that open their associated info windows when clicked.


Creating Expandable & Collapsible Div In JQuery & HTML

The use of expandable and collapsible panels is widespread on the Internet. There are many plugins and code available that allow you to implement various types of expandable content or ‘accordion’ effects which essentially involve the user clicking on a panel heading to reveal the content underneath. Expandable panels are often used as a way to break up content rich pages into more visually appealing sections, where visitors can choose to read more about a particular section if they wish.

This tutorial walks through the processes and code required to create your own version of expandable panels using a mix of HTML, CSS and jQuery. Modifying and styling the panels is easy and the code has been tested on multiple browsers and devices including Internet Explorer 8, 9 and 10 as well as Chrome, FireFox and Safari. The expandable panels are also responsive and fit 100% of the parent container.

Demo                             


Complete 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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Demo of expandable &amp; collapsible panels in jQuery</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">
(function($) {
    $(document).ready(function () { 
        /*-------------------- EXPANDABLE PANELS ----------------------*/
        var panelspeed = 500; //panel animate speed in milliseconds
        var totalpanels = 3; //total number of collapsible panels   
        var defaultopenpanel = 0; //leave 0 for no panel open   
        var accordian = false; //set panels to behave like an accordian, with one panel only ever open at once      

        var panelheight = new Array();
        var currentpanel = defaultopenpanel;
        var iconheight = parseInt($('.icon-close-open').css('height'));
        var highlightopen = true;
         
        //Initialise collapsible panels
        function panelinit() {
                for (var i=1; i<=totalpanels; i++) {
                    panelheight[i] = parseInt($('#cp-'+i).find('.expandable-panel-content').css('height'));
                    $('#cp-'+i).find('.expandable-panel-content').css('margin-top', -panelheight[i]);
                    if (defaultopenpanel == i) {
                        $('#cp-'+i).find('.icon-close-open').css('background-position', '0px -'+iconheight+'px');
                        $('#cp-'+i).find('.expandable-panel-content').css('margin-top', 0);
                    }
                }
        }

        $('.expandable-panel-heading').click(function() {           
            var obj = $(this).next();
            var objid = parseInt($(this).parent().attr('ID').substr(3,2));  
            currentpanel = objid;
            if (accordian == true) {
                resetpanels();
            }
             
            if (parseInt(obj.css('margin-top')) <= (panelheight[objid]*-1)) {
                obj.clearQueue();
                obj.stop();
                obj.prev().find('.icon-close-open').css('background-position', '0px -'+iconheight+'px');
                obj.animate({'margin-top':0}, panelspeed);
                if (highlightopen == true) {
                    $('#cp-'+currentpanel + ' .expandable-panel-heading').addClass('header-active');
                }
            } else {
                obj.clearQueue();
                obj.stop();
                obj.prev().find('.icon-close-open').css('background-position', '0px 0px');
                obj.animate({'margin-top':(panelheight[objid]*-1)}, panelspeed); 
                if (highlightopen == true) {
                    $('#cp-'+currentpanel + ' .expandable-panel-heading').removeClass('header-active');   
                }
            }
        });
         
        function resetpanels() {
            for (var i=1; i<=totalpanels; i++) {
                if (currentpanel != i) {
                    $('#cp-'+i).find('.icon-close-open').css('background-position', '0px 0px');
                    $('#cp-'+i).find('.expandable-panel-content').animate({'margin-top':-panelheight[i]}, panelspeed);
                    if (highlightopen == true) {
                        $('#cp-'+i + ' .expandable-panel-heading').removeClass('header-active');
                    }
                }
            }
        }
             

        $(window).load(function() {
  panelinit();
        }); //END LOAD
    }); //END READY
})(jQuery);
</script>


<style type="text/css">
/* --------- COLLAPSIBLE PANELS ----------*/

h2, p, ol, ul, li {
margin:0px;
padding:0px;
font-size:13px;
font-family:Arial, Helvetica, sans-serif;
}
ol, ul {
padding:3px 0 10px 22px;
}
li {
padding:0 0 4px 0;
}
hr {
border:none;
height:1px;
border-top:1px dashed #999;
}
#container {
width:300px;
margin:auto;
margin-top:100px;
}

.expandable-panel {
    width:100%; 
    position:relative;
    min-height:50px;
    overflow:auto;
    margin-bottom: 20px;
border:1px solid #999;
}   
.expandable-panel-heading {
    width:100%; 
    cursor:pointer;
    min-height:50px;
    clear:both;
    background-color:#E5E5E5;
    position:relative;
}
.expandable-panel-heading:hover {
    color:#666;
}
.expandable-panel-heading h2 {
    padding:14px 10px 9px 15px; 
    font-size:18px;
    line-height:20px;
}
.expandable-panel-content { 
    padding:0 15px 0 15px;
    margin-top:-999px;
}
.expandable-panel-content p {
    padding:4px 0 6px 0;
}
.expandable-panel-content p:first-child  {
padding-top:10px;
}
.expandable-panel-content p:last-child {
padding-bottom:15px;
}
.icon-close-open {
    width:20px;
    height:20px;
    position:absolute;
    background-image:url(icon-close-open.png);
    right:15px;
}

.expandable-panel-content img {
float:right;
padding-left:12px;
clear:both;
}
.header-active {
    background-color:#D0D7F3;
}

</style>
</head>
<body>
<div id="container">
    <div class="expandable-panel" id="cp-1">
        <div class="expandable-panel-heading">
            <h2>Panel content heading 1<span class="icon-close-open"></span></h2>
      </div>
        <div class="expandable-panel-content">
            <p>This is a regular paragraph within the first collapsible panel.</p>
            <hr />
            <p>A second paragraph after a HR element within the first collapsible panel.</p>
        </div>
    </div>
     
    <div class="expandable-panel" id="cp-2">
        <div class="expandable-panel-heading">
            <h2>Panel content heading 2<span class="icon-close-open"></span></h2>
      </div>
        <div class="expandable-panel-content">
             <p>Another collapsible panel. The following variables can be set expandable panels:</p>
            <ol>
            <li><em>panelspeed:</em> defines panel expand/collapse speed in milliseconds</li>
                <li><em>totalpanels:</em> the total number of colapsible panels used</li>
                <li><em>defaultopenpanel:</em> leave at 0 to keep all panels initially closed</li>
                <li><em>accordian:</em> sets accordion effect (only one panel can remain open at once)</li>
            </ol>
        </div>
    </div>
     
    <div class="expandable-panel" id="cp-3">
        <div class="expandable-panel-heading">
            <h2>Panel content heading 3<span class="icon-close-open"></span></h2>
      </div>
        <div class="expandable-panel-content">
        
        <p><img src="image1.jpg" height="70" alt="penguins" />This last collapsible panel contains an image floated right to the paragraph content.</p>
        <p>One thing good to note with the expandable panels is that adding top or bottom padding to the expandable-panel-content class can cause animation issues in IE 8</p>
        </div>
    </div>
     <p style="margin-top:50px;"><a style="color:#CCC;" href="http://www.webdevdoor.com/jquery/expandable-collapsible-panels-jquery/">Return to expandable panels post &raquo;</a></p>
</div>

</body>
</html>
         

Thursday, 28 November 2013

PHP jQuery Comment/News Updates Script

Hi, today i am going to show you about facebook auto updates, as we seen in facebook at right side top of the corner we able to see the user activity updates, i have done same concept using jquery, ajax and php, let's see how we do this - See more at: http://www.lessoncup.com/2013/11/jquery-news-updates.html#sthash.voMAxzug.dpuf

DEMO                         DOWNLOAD

index.php

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>jQuery News Updates</title>

<script type="text/javascript" src="jquery-1.10.2.min.js"></script>

<script>

$(document).ready(function(){

$('.send').click(function(){

var name=$('#name').val();
var mess=$('#mess').val();
if(name==""){
alert('enter your name');
}else if(mess==""){
alert('enter your message');
}else{

var messdata= "name="+name+"&mess="+mess;
$("#loader").show();
$("#loader").fadeIn(400).html('<img src="loader.gif" align="absmiddle">&nbsp;<span class="loading">Loading updates</span>');
$('.send').css({ "width": "82px", "cursor": "wait" });
$('.send').text('Tweeting wait..');
$.ajax({
type:"post",
data:messdata,
url:"sendmessage.php",
cache:false,
success:function(msg){

$(".forms1").val('');
$("#loader").hide();
$("ul#amsalert").prepend(msg);
$("ul#amsalert li:first").slideDown(500);
$('.send').css({ "width": "40px", "cursor": "pointer" });
$('.send').text('Tweet');

}
});
}
});
});

</script>

<style>

body{ font-family:Verdana, Geneva, sans-serif; color:#000; font-size:11px; background-color:#FFF; margin:0; padding:0;}

.lessoncup{width:300px; height:auto;border:solid #6895CC 1px;-webkit-box-shadow: 0 2px 5px #666;
box-shadow: 0 2px 5px #666; padding:10px;font-family:Arial, Helvetica, sans-serif; font-size:11px; margin:50px 0 0 400px; float:left;}

.messages{width:250px; height:638px; overflow:hidden;border:solid #8CACDD;font-family:Arial, Helvetica, sans-serif;font-size:11px; float:right; border-width:0 0 1px 1px;}

#loader{font-size:12px;display:none; margin:0 auto; width:112px; height:20px; padding:10px;}

#amsalert{ color:#fff; padding:0;list-style:none; margin:0; padding-left:1px;}

#amsalert li{ background-color:#6895CC; margin-top:1px; padding:10px; display:none; cursor:pointer;}

#amsalert li:hover{ background-color:#4E65C0; cursor:pointer;}

#msalert{ color:#fff; padding:0;list-style:none; margin:0; padding-left:1px;}

#msalert li{ background-color:#6895CC; margin-top:1px; padding:10px;}

#msalert li:hover{ background-color:#4E65C0; cursor:pointer;}

#mname{ color:#FF0; font-weight:bold;}

.ul{ margin:0; padding:0; list-style:none;}

.ul li{ padding:10px; padding-bottom:0; font-size:12px; color:#000;}

.send{ background-color:#6895CC; border:none; border-radius:5px; padding:10px; width:40px; cursor:pointer; color:#fff;}

.send:hover{ background-color:#4E65C0;}

.forms1{color:#333;padding:10px; width:200px; border:solid #6895CC 1px; font-size:14px; resize:none; margin:5px 0 5px 0; outline:none;border-radius:5px;}

#formbox{width:240px; height:auto;margin:0 auto;}



</style>

</head>

<body>

<div class="lessoncup">
<div id="formbox">

    <ul class="ul">
      <li> <span> Name:</span><br/>
        <input name="name" type="text" id="name" class="forms1" placeholder="name">
      </li>
      <li>Message<span>:</span><br/>
        <textarea name="mess" class="forms1" id="mess" placeholder="enter message"></textarea>
      </li>
      
      <li style="margin-top:5px;">
        <div class="send">Tweet</div>
      </li>
    </ul>
  </div>
</div>

<div class="messages">
<div id="loader"></div>
<ul id="amsalert">

</ul>
<?php include("messagealerts.php")?>
</div>



<div style="margin:0 auto; clear:both;width:400px;font-family:Verdana, Geneva, sans-serif; font-size:9px; color:#CCC; margin-top:10px;">(c) Mohammad Khasim Productions - for more lessons<strong>&nbsp;<a href="http://www.lessoncup.com" style="text-transform:lowercase;" target="_blank">www.lessoncup.com</a></strong></div>
</body>
</html>

sendmessage.php


<?php
extract($_REQUEST);
include("db.php");

$sql=mysql_query("insert into messages(name,message) values('$name','$mess')");

$msql=mysql_query("select * from messages order by mid desc");
$mrow=mysql_fetch_array($msql);
?>

<li><span id="mname"><?php echo $mrow['name']?></span><br/>
<?php echo substr($mrow['message'],0,40);?>
</li>


messagealerts.php


<?php
extract($_REQUEST);
include("db.php");

$sql=mysql_query("select * from messages order by mid desc limit 0 , 20");
while($row=mysql_fetch_array($sql)){
?>
<ul id="msalert">
<li><span id="mname"><?php echo $row['name']?></span><br/>
<?php echo substr($row['message'],0,40);?>
</li>
</ul>
<?php }?>

Friday, 15 November 2013

Php Ajax Datagrid Example

DataGrid has an extremely simple and flexible API. This allows developers to begin using DataGrid very quickly, and allows them to access even advanced features with ease. DataGrid ships with examples covering virtually all features of the grid, that provide a simple and effective way of showing how to use the API. We've taken a few of these examples to convey some idea of the simplicity of using DataGrid in any PHP application.

DataGrid with AJAX features

View Data
Dependent dropdown lists (regions and countries)
Tabular(inline) layout for filtering
AJAX paging, details
Tree PostBack methods: GET, POST and AJAX
etc.

Demo                                              Download

Database:

-- phpMyAdmin SQL Dump
-- version 2.11.5
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Nov 15, 2013 at 06:37 AM
-- Server version: 5.0.51
-- PHP Version: 5.2.5

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

--
-- Database: `sales`
--



--
-- Table structure for table `calling_info`
--

CREATE TABLE `calling_info` (
  `call_id` bigint(255) NOT NULL auto_increment,
  `Mobile` varchar(255) NOT NULL,
  `com_name` varchar(255) NOT NULL,
  `telesales` varchar(255) NOT NULL,
  `call_date` varchar(255) NOT NULL,
  `call_date1` datetime NOT NULL,
  PRIMARY KEY  (`call_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1005 ;

Wednesday, 6 November 2013

JQuery ajax method to get content of another file

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="jquery-1.9.0.min.js"></script>
<script>
function fun1()
{
 $.ajax({
  url:"audio.html",
  success: function(data){
   $("#msg").html(data);
   }
  });
}
</script>
</head>

<body>
<input type="button" value="load" onclick="fun1()" />
<div id="msg">
</div>
</body>
</html>

Appending Content In The Div

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
<style>
#msg{
 width:260px;
 height:60px;
 background-color:#CCC;
 padding:20px;
}
h3{
 width:300px;
 border:1px solid #CCC;
 text-align:center;
 cursor: pointer;
 cursor: hand;
 margin-bottom:20px;
}
</style>
<script src="jquery-1.10.2.min.js"></script>
<script>
$(document).ready(function() {
    $("h3").click(function(){
  $("#msg").append("<p>'Write less: Do more'</p>");  
 });
});
</script>
</head>

<body>
<h3>Click to append Content</h3>
<div id="msg">jQuery is a fast, small and feature-rich <b>JavaScript</b> library.</div>
</body>
</html>

Create Image Slider Using Jquery

In this web design tutorial, we will learn to create custom image slider above using Photoshop, which you can preview the final result from here. Not only will we illustrate it in Photoshop, we will also turn it into a functional design by converting it into HTML/CSS and adding jQuery for its awesome sliding effect.

Demo

<script src="jquery-1.9.1.js"></script>
<script src="jquery.cycle.all.js"></script>
<script>
function slider()
{
$("#div1").cycle({fx:'scrollLeft'})
}
</script>
<body onload="slider()">
<div id="div1" style="position:absolute;top:100;left:100;">
<img src="1.jpg" width="200">
<img src="2.jpg" width="200">
<img src="3.jpg" width="200">
<img src="4.jpg" width="200">
</div>
</body>