Giter Site home page Giter Site logo

alexlaforge / inlinetweetjs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ireade/inlinetweetjs

0.0 2.0 0.0 33 KB

InlineTweet.js allows you to easily create tweetable links out of any text on a webpage

Home Page: http://ireade.github.io/inlinetweetjs/

JavaScript 33.62% HTML 33.68% CSS 32.71%

inlinetweetjs's Introduction

InlineTweet.js

InlineTweet.js allows you to easily create tweetable links out of any text on a webpage. Just wrap the tweetable text in a container with data-inline-tweet and you're good to go!

SEE DEMO

How to Use

1 - Include Script

Download the file from here and include it in your webpage.

<script src="path/to/inline-tweet.min.js"></script>

2 - Wrap Text

Wrap the tweetable text in a container element of your choice (span recommended) with the data attribute, data-inline-tweet

<span data-inline-tweet>Lorem Khaled Ipsum is a major key to success</span>

3 - Additional Options

You can add more data attributes to cutomise the tweeted output -

  • data-inline-tweet-via โ€” Add a twitter username (without the @) to append to the tweet
  • data-inline-tweet-tags - Add hashtags to the tweet (comma-separated, no spaces)
  • data-inline-tweet-url โ€” Tweet a URL different to the current page url
<span data-inline-tweet       
	  data-inline-tweet-via="ireaderinokun"   
	  data-inline-tweet-tags="webdesign,webdev,js,yolo"    
	  data-inline-tweet-url="bitsofco.de">   
	Lorem Khaled Ipsum is a major key to success 
</span>

4 - Add Styles

Add the following styles to your stylesheet -

[data-inline-tweet] a {   
	text-decoration: none;   
	color: #000; 
} 
[data-inline-tweet] a span {   
	border-bottom: 1px dotted rgb(0,172,237);   
	font-style: italic;      
	margin-right: 10px; 
} 
[data-inline-tweet] a:hover span {   
	background-color: rgba(0,172,237,0.1);   
	color: rgb(0,172,237); 
}

inlinetweetjs's People

Watchers

James Cloos avatar Alex Laforge avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.