Articles by "Javascript"

2019 4G LTE 4G VoLTE 5G 7th Pay Commission Aadhaar Actor Wallpapers Actress Wallpaper Adriana Lima AdSense Ahoi Ashtami Airtel Airtel DTH Akshay Kumar Alcatel Alexa Rank Amazon Android Android Pie Android Q Anna university Antivirus Anushka Sharma apna csc online Apple Apps Army Army App Asthma Asus Atal Seva mirchpur Athletics Auto Auto Insurance Avengers Axis Bank Backlinks Badhajmi Bajaj Bang Bang Reloaded Bank Battery Bhai Dooj Katha Bhakti Bharti Bhumi Pednekar Big Bazaar Big TV Bing BlackBerry Blogger BlogSpot Bluetooth BoB Bollywood Boot Boxing Breathlessness Browser BSEH Bsnl Budget Budhvar Business buy Cable TV Camera Car Car Loan Card Less ATM Cash CBSE Celebrity CEO Chandra Grahan Channels Chest Pain Chhath chrome Clean WhatsApp Cache Common Service Centres (CSC) Mirchpur Hisar Haryana - Front of Jyoti Sen Sec School Mirchpur Comparisons Computer Coolpad Corona COVID 19 COVID 19 HARYANA Credit Cricket Crime CSC Cylinder Dama Dard Deepika Padukone Defence Detel Dhanteras Diamond Crypto DigiLocker App DigiPay App Digital India App Digital Indian Gov Dish TV Diwali DNS setting Domain Donate Doogee DTH DTH Activation DTH Installation DTH Plans in India Dusshera E-seva Kender mirchpur Earn Money Education Electronics Email Entertinment Ex-serviceman Extensions Facebook FASTag Fatigue Festivals FlicKr Flipkart Foldable Smartphone Food Foursquare Funny Gadgets Galaxy Galaxy S8 Game Ganesh ganesh chaturthi Gas Problems Gastric Problem Gharelu Gionee Gmail God Google Google + Google Assistant Google Drive Google Duo Google Pixel Google Tez Google Voice Google+ Govardhan Puja GroupMe GST GTA Guide GuruSatsang Guruvar Hamraaz hamraaz app hamraaz app download hamraaz army hamraaz army app hamraaz army app download Hamraaz Army App version 6 Apk Happy New Year Hariyali Teej Hartalika Teej Harvard University Haryana haryana csc online HDFC Bank Headphones Health Heart Attack Heart Fail Heart Problems Heart Stroke Heena Sidhu Hello App Help Hernia Hindi History Hockey Holi Holi Katha Hollywood Home Loan Honor HostGator Hosting Hrithik Roshan HTC Huawei humraaz app iBall IBM ICICI Bank Idea Ilaj India india vs china indian army app Indigestion Infinix InFocus Information Infosys Instagram Insurance Intel Internet Intex Mobile iPad iPhone iPhone 8 IPL IRCTC iVoomi Jan Dhan Account Janmashtami Japanese Encephalitis Javascript JBL Jio Jio GigaFiber Jio Meet JioPOS JioRail JioSaavn Jokes Kamjori Karbonn Kareena Kapoor Kartik Purnima Karva Chauth Karwa Chauth Kasam Tere Pyaar Ki Katrina Kaif Kendall Jenner Keywords Kimbho Kodak Kumkum Bhagya Kushth Rog Landline Laptop Lava Lenovo Leprosy LET Lethargy LG Library of Congress Lifestyle Linkedin Lisa Haydon Livejournal Liver Cancer Loans LPG Gas mAadhaar Macbook Maha Shivratri Makar Sankranti Map Market Mary Kom Massachusetts Institute of Technology Meizu Messages Mi Micromax Microsoft Mobile Modi Mokshada Ekadashi Money Motorcycles Motorola Movie Muscle Pain Music Myspace Narendra Modi Narsingh Jayanti Nature Naukri Navratri Nemonia Netflix Network News Nexus Nia Sharma Nokia Notifications Nuskhe OBC Ocean Office Offrs Ola Cab OMG OnePlus Online Opera Oppo Oreo Android Orkut OS OxygenOS Padmavati PagalWorld Pain Pain Sensation Pakistan PAN PAN Card Panasonic Passwords Patanjali Pay Payment Paypal Paytm PC PDF Peeda Pendrive Pension Personal Loan Pet Me Gas PF Phone Photo PHP Pila Bukhar Pinterest Pixel Plan PNB Bank Pneumonia PNR Poco Poster PPC Pradhan Mantri Kisan Samman Nidhi Pradhanmantri Kisan Samman Nidhi Yojna Pradosh Pragya Jaiswal Prepaid Princeton University Printer Priyanka Chopra promote my youtube channel promote video on youtube cost promote youtube channel promote youtube channel free promote youtube video free PUBG Qualcomm Quora Quotes Race 3 Railway Rambha Tritiya Vrat RBI Realme Recruitment Redmi Relationship Religious Restore Results Review Rule Sai Dharam Tej Saina Nehwal Salman Khan Samsung Sanusha Satsang Video Sawan Somvar Vrat SBI Bank Script Sell SEO Serial Server Shabd Shahid Kapoor Shanivar Sharad Poornima Sharp Shiv Shopping Shreyasi Singh Shruti Haasan Signal Sim Smart Android TV Smartphones SMS Snapchat Social Software Somvar Sonakshi Sinha Sonam Kapoor Soney Songs Sony Xperia Space Speakers Specifications Sports Sql Stanford University State Bank of India Stickers Stomach Upset Story Sun Direct Sunny Leone Surabhi Sushant Singh Rajput Swadeshi Swas Rog Tata Sky Tax Tech Technology Tecno Telegram Telugu Thakan Tiger Shroff Tiger Zinda Hai Tips Tiredness Tollywood Tool Top Trending People Trading Trai TRAI Rules for cable TV Trailer Treatment Trends True Things Truecaller Tubelight Tulsi Vivah Tumblr Tv Twitter Typing Uber Umang App University of Oxford UP Board Upay Upchar Update USA USB Vacancies Valentines Day Verizon Vertu Viber Video Videocon d2h Videos Vijayadashami Viral Bukhar Viral Fever Virat Kohli Virgin Visas Vivo VLE Vodafone Voter Card VPN Vrat Katha Vrat Vidhi Wallpaper War Wayback Machine Weakness WhatsApp WhatsApp Cleaner WhatsApp Status WhatsApp stickers Wi-Fi WiFi Windows Windows 10 Wipro Wireless WordPress workstation WWE Xiaomi Xiaomi Mi 6 Yeh Hai Mohabbatein Yellow Fever Yo Yo Honey Singh Yoga yojna YotaPhone YouTube youtube promotion youtube promotion free ZTE अपच अस्थमा आलस्य इलाज उपचार उपाय उमंग ऐप कहानियाँ कुष्ठरोग कोरोना वायरस गुरुसत्संग घरेलू जन धन योजना जापानी इन्सेफेलाइटिस डिजिटल इंडिया डिजिटल इंडिया अप्प्स डिजिपे ऐप डिजीलॉकर ऐप थकान दमा दर्द निमोनिया नुस्ख़े पीड़ा पीतज्वर पीला बुखार पेट में गैस पैन कार्ड प्रधानमंत्री किसान सम्मान निधि बदहज़मी भक्ति मांसपेशियों में दर्द लीवर कैंसर वायरल बुखार वोटर कार्ड शब्द सच्ची बातें सत्संग वीडियो सरसों सीने में दर्द स्कीम स्वास रोग हर्निया
Showing posts with label Javascript. Show all posts

How to create Bit.ly short URLs using Jquery and Ajax. Many tutorials available on web about short URLs using server side script, this script works on client side. It is easy just 5 lines of code calling Bit.ly API. You have to modify the username and API key. Use it and make URLs shorts and neat.

Javascript Code
You have to create an account on bit.ly and modify the username and API key.
<script type="text/javascript" src="http://ajax.googleapis.com/
ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{

//bit_url function
function bit_url(url

var url=url;
var username="username"; // bit.ly username
var key="bit.ly API key";
$.ajax({
url:"http://api.bit.ly/v3/shorten",
data:{longUrl:url,apiKey:key,login:username},
dataType:"jsonp",
success:function(v)
{
var bit_url=v.data.url;
$("#result").html('<a href="'+bit_url+'" target="_blank">'+bit_url+'</a>');
}
});
}


$("#short").click(function()
{
var url=$("#url").val();
var urlRegex = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
var urltest=urlRegex.test(url);
if(urltest)
{
bit_url(url);
}
else
{
alert("Bad URL");
}
});

});
</script>

//HTML Code
<input type="text" name="url" id="url"/> 
<input type="submit" id="short" value="Submit"/> 
<div id="result"></div>

This javascript code $("#short").click(function(){}short is the id name of the submit button. Using $("#url").val() calling input box value. 

I had designed a magical feedback form using Jquery with easing animation effect. It's simple and intersting just hiding and showing the div tags with jquery. Use it and make some thing better your web project feedback box.

Javascript Code
Contains five animation move functions. Four click actions take a look at click(function()
<script type="text/javascript" src="http://ajax.googleapis.com/
ajax/libs/jquery/1.4.2/jquery.min.js
"></script>
<script type="text/javascript" src="jquery.easing.1.3.js.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
var feed_width = $('#feedback').width();
var scr_w = screen.width; // Screen Width
// 26 is width of the veritcal feedback button
var btn_width = 26;
var move_right = scr_w - btn_width;
var move_left = -(feed_width - btn_width);
var slide_from_left = 0;
var slide_from_right = scr_w - (feed_width - btn_width);
var center = ( scr_w / 2 ) - ( feed_width / 2 );

function positioningForm()
{
$('.left_btn').hide();
$('#feedback').css({"left": move_right+"px"}).show();
}
function slideFromRight()
{
$('#feedback').animate(
{left: slide_from_right+"px"},
{duration: 'slow',easing: 'easeOutElastic'});
$('.left_btn').hide();
}
function slideFromleft()
{
$('#feedback').animate(
{left: slide_from_left+"px"},
{duration: 'slow',easing: 'easeOutElastic'});
$('.right_btn').hide();
}
function moveLeft()
{
$('#feedback').animate(
{left: move_left+"px"},
{duration: 'slow',easing: 'easeOutElastic'});
$('.left_btn').show();
}
function moveRight()
{
$('#feedback').animate(
{left: move_right+"px"},
{duration: 'slow',easing: 'easeOutElastic'});
$('.right_btn').show();
}

// Positioning the feedback form at the time of page loading
positioningForm();

// Handling the right_btn and lift_btn event animations
$('.right_btn').click(function()
{
slideFromRight();
});

$('.left_btn').click(function()
{
slideFromleft();
});

// Moving left or right by clicking close button
$('.feed_close').click(function()
{
var pos = $('#feedback').position();
var ls = pos.left;
if(ls == slide_from_left)
{
// feedback form is at LEFT
moveRight();
}
else if(ls == center)
{
// feedback form is at RIGHT
moveRight();
}
else
{
// feedback form is at CENTER
moveLeft();
}
});
// Submit Form values

$('#submit_btn').click(function()
{
var name=$('#name').val();
var email=$('#email').val();
var msg=$('#msg').val();
if(name.length>0 && email.length>0 && msg.length>0)
{
$('.left_btn').hide();
$('.right_btn').hide();
$('.box').hide();
$('#feedback').animate(
{left: center+"px"},
{duration: 'slow',easing: 'easeOutElastic'});
$('.thankyou').show();
}
else
{
$('#error').html('Enter some thing');
}
return false();
});

});
</script>

HTML Code
Contains simple HTML code.
<div id="feedback"> 
<div class="right_btn"><img src="images/feed_right_btn.png" width="26px" height="99px"/></div> 

<div class="formdiv"> 

<div class='thankyou'> 
<h3>Thank you !</h3> 
<div class="feed_close"><img src="images/feed_close_btn.png" width="16px" height="15px"/></div> 
</div> 

<div class="box"> 
<table border="0"> <tr> 
<td><label>Name:</label><br/><input type="text" name="name" id="name"/> </td> 
<td valign="middle" align="right"><div class="feed_close"><img src="images/feed_close_btn.png" width="16px" height="15px"/></div></td> 
</tr> <tr> 
<td colspan="2"><label>Email:</label><br/><input type="text" name="email" id="email"/></td> 
</tr> <tr> 
<td colspan="2"><label>Message: </label><br/&gt;<textarea rows="5" cols="16" name="msg" id="msg"></textarea></td> 
</tr> <tr> 
<td colspan="2"><input id="submit_btn" type="submit" value="Submit"/><span id="error"></span></td> 
</tr> </table> 
</div> 
</div> 

<div class="form_submit"></div> 
<div class="left_btn"><img src="images/feed_left_btn.png" width="26px" height="99px"/></div> 
</div>

CSS
body{
width: 100%;
overflow: hidden; /* This is IMP */
padding: 0;
margin: 0 auto;
}
#feedback{
width: 362px;
padding: 10px;
position: absolute;
top: 100px;
display: none;
}
#feedback .formdiv{
width: 300px;
float: left;
background-color: #6f115c;
padding: 0px 5px 5px 5px;
-moz-border-radius-bottomright: 6px;
-moz-border-radius-bottomleft: 6px;
border-bottom-right-radius:6px;
border-bottom-left-radius:6px;
min-height:100px;
}
#feedback label{
font:bold 11px arial;
color: #febaf9;
}
#feedback textarea{
width: 290px;
height: 100px;
color: #fcd1f2;
font: normal 11px verdana;
border: none;
padding: 5px;
background-color: #943080;
-moz-box-shadow: inset 1px 1px 1px #4c0b3f;
-webkit-box-shadow: inset 1px 1px 1px #4c0b3f;
resize: none; /* disable extending textarea in chrome */
}
#feedback input[type="text"]{
color: #606060;
font: normal 11px verdana;
padding: 3px;
width: 200px;
height: 25px;
border: none;
color: #fcd1f2;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
background-color: #943080;
-moz-box-shadow: inset 1px 1px 1px #4c0b3f;
-webkit-box-shadow: inset 1px 1px 1px #4c0b3f;
}
#feedback input[type="submit"]{
background-color: #ffaffa;
border: none;
color: #6f115c;
font:bold 11px arial;
padding: 2px 6px;
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
cursor: pointer;
}
#feedback .left_btn,
#feedback .right_btn{
width: 26px;
height: 100px;
float: left;
cursor: pointer;
}

#feedback .feed_close{
cursor: pointer;
margin:-15px -5px 0px 0px;
}
#error
{
color:#fff;
padding:4px;
font-size:11px;
}
.thankyou
{
text-align:center;
display:none;
}

I received lot of requests from my readers that asked to me how to design Twitter and Facebook like status message(image + text) with CSS. So that I had presented a very basic level CSS tutorial with Div and Ol tags, truly it's for CSS beginners. I hope you like this. Thanks!

HTML Code
Here stbodystimg and sttext are class names of BodyImage and Text div tags respectively.
<div class="stbody">

<div class="stimg">
2 Image Part
</div> 

<div class="sttext">
3 Text Part
</div> 

</div>


CSS Code
word-wrap:break-work for text justification. 
.stbody
{
min-height:70px;
margin-bottom:10px;
border-bottom:dashed 1px #cc0000;
}
.stimg
{
float:left;
height:50px;
width:50px;
border:solid 1px #dedede;
padding:5px;
}
.sttext
{
margin-left:70px;
min-height:50px;
word-wrap:break-word// Text justification
overflow:hidden;
padding:5px;
display:block;
font-family:'Georgia', Times New Roman, Times, serif
}


HTML Code
<div class="stbody">

<div class="stimg">
<img src="sri.jpg" />
</div> 
<div class="sttext">
9lessons programming blog <a href="http://www.9lessons.info">http://9lessons.info</a> 
<div class="sttime">2 seconds ago</div> 
</div> 

</div>

Order List Tag
I suggest you do with order list tag it's very flexible for jquery animation effects. 
<ol> 
// Loop Start
<li class="stbody">
<div class="stimg">
<img src="sri.jpg"/>
</div> 
<div class="sttext">
9lessons programming blog http://9lessons.info
<div class="sttime">2 seconds ago</div> 
</div> 
</li> 
//Loop End
</ol>

CSS Code
ol
{
list-style:none;
margin:0px;
padding:0px;
}
.stbody
{
min-height:70px;
margin-bottom:10px;
border-bottom:dashed 1px #cc0000;
}
.stimg
{
float:left;
height:50px;
width:50px;
border:solid 1px #dedede;
padding:5px;
}
.sttext
{
margin-left:70px;
min-height:50px;
word-wrap:break-word;
overflow:hidden;
padding:5px;
display:block;
font-family:'Georgia', Times New Roman, Times, serif
}

Digitalindiagov.com

Satish Kumar

Contact Form

Name

Email *

Message *

Powered by Blogger.